@diia-inhouse/diia-queue 14.3.0 → 14.4.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExchangeName } from "./messageBrokerServiceConfig.js";
|
|
2
2
|
import { HttpStatusCode } from "@diia-inhouse/types";
|
|
3
|
-
import { ValidationSchema } from "@diia-inhouse/validators";
|
|
3
|
+
import { ArrayRule, ValidationSchema } from "@diia-inhouse/validators";
|
|
4
4
|
|
|
5
5
|
//#region src/interfaces/externalCommunicator.d.ts
|
|
6
6
|
/**
|
|
@@ -25,7 +25,7 @@ interface ReceiveDirectOps {
|
|
|
25
25
|
*
|
|
26
26
|
* Null is acceptable only for legacy use cases.
|
|
27
27
|
*/
|
|
28
|
-
validationRules: ValidationSchema | null;
|
|
28
|
+
validationRules: ValidationSchema | ArrayRule | null;
|
|
29
29
|
/** Bypass response caching on the subscriber side if configured. */
|
|
30
30
|
ignoreCache?: boolean;
|
|
31
31
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueueMessageData } from "../interfaces/providers/rabbitmq/index.js";
|
|
2
|
-
import { AppValidator, ValidationSchema } from "@diia-inhouse/validators";
|
|
2
|
+
import { AppValidator, ArrayRule, ValidationSchema } from "@diia-inhouse/validators";
|
|
3
3
|
|
|
4
4
|
//#region src/services/eventMessageValidator.d.ts
|
|
5
5
|
declare class EventMessageValidator {
|
|
@@ -7,7 +7,8 @@ declare class EventMessageValidator {
|
|
|
7
7
|
readonly metaValidationSchema: ValidationSchema;
|
|
8
8
|
constructor(validator: AppValidator);
|
|
9
9
|
validateEventMessage(data: QueueMessageData, payloadValidationSchema?: ValidationSchema): void | never;
|
|
10
|
-
validateSyncedEventMessage(data: QueueMessageData, responseValidationSchema?: ValidationSchema): void | never;
|
|
10
|
+
validateSyncedEventMessage(data: QueueMessageData, responseValidationSchema?: ValidationSchema | ArrayRule): void | never;
|
|
11
|
+
private isArrayRule;
|
|
11
12
|
}
|
|
12
13
|
//#endregion
|
|
13
14
|
export { EventMessageValidator };
|
|
@@ -47,13 +47,19 @@ var EventMessageValidator = class {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
if (responseValidationSchema) validation.response = {
|
|
50
|
+
if (responseValidationSchema) validation.response = this.isArrayRule(responseValidationSchema) ? {
|
|
51
|
+
optional: true,
|
|
52
|
+
...responseValidationSchema
|
|
53
|
+
} : {
|
|
51
54
|
type: "object",
|
|
52
55
|
optional: true,
|
|
53
56
|
props: responseValidationSchema
|
|
54
57
|
};
|
|
55
58
|
this.validateEventMessage(data, validation);
|
|
56
59
|
}
|
|
60
|
+
isArrayRule(schema) {
|
|
61
|
+
return "type" in schema && schema.type === "array";
|
|
62
|
+
}
|
|
57
63
|
};
|
|
58
64
|
//#endregion
|
|
59
65
|
export { EventMessageValidator };
|