@hahnpro/flow-sdk 4.19.0 → 4.19.1
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/dist/FlowElement.d.ts +1 -0
- package/dist/FlowElement.js +14 -2
- package/package.json +1 -1
package/dist/FlowElement.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare abstract class FlowElement<T = any> {
|
|
|
30
30
|
protected emitOutput(data?: any, outputId?: string, time?: Date): FlowEvent;
|
|
31
31
|
protected emitEvent(data: any, inputEvent: FlowEvent, outputId?: string, time?: Date): FlowEvent;
|
|
32
32
|
protected validateProperties<P>(classType: ClassType<P>, properties?: any, whitelist?: boolean): P;
|
|
33
|
+
protected logValidationErrors(error: any, parent?: string): void;
|
|
33
34
|
protected validateEventData<E>(classType: ClassType<E>, event: FlowEvent, whitelist?: boolean): E;
|
|
34
35
|
protected interpolate: (value: any, ...templateVariables: any) => any;
|
|
35
36
|
protected callRpcFunction(functionName: string, ...args: any[]): Promise<unknown>;
|
package/dist/FlowElement.js
CHANGED
|
@@ -64,9 +64,9 @@ class FlowElement {
|
|
|
64
64
|
validateProperties(classType, properties = {}, whitelist = false) {
|
|
65
65
|
const props = (0, class_transformer_1.plainToClass)(classType, properties);
|
|
66
66
|
const errors = (0, class_validator_1.validateSync)(props, { whitelist });
|
|
67
|
-
if (
|
|
67
|
+
if (Array.isArray(errors) && errors.length > 0) {
|
|
68
68
|
for (const e of errors) {
|
|
69
|
-
this.
|
|
69
|
+
this.logValidationErrors(e);
|
|
70
70
|
}
|
|
71
71
|
throw new Error('Properties Validation failed');
|
|
72
72
|
}
|
|
@@ -74,6 +74,18 @@ class FlowElement {
|
|
|
74
74
|
return props;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
logValidationErrors(error, parent) {
|
|
78
|
+
const { children, constraints, property, value } = error;
|
|
79
|
+
const name = parent ? parent + '.' + property : property;
|
|
80
|
+
if (constraints) {
|
|
81
|
+
this.logger.error(`Validation for property "${name}" failed:\n${JSON.stringify(constraints || {})}\nvalue: ${value}`);
|
|
82
|
+
}
|
|
83
|
+
else if (Array.isArray(children)) {
|
|
84
|
+
for (const child of children) {
|
|
85
|
+
this.logValidationErrors(child, name);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
77
89
|
validateEventData(classType, event, whitelist = false) {
|
|
78
90
|
return this.validateProperties(classType, event.getData(), whitelist);
|
|
79
91
|
}
|