arvo-event-handler 3.0.16 → 3.0.17
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.
|
@@ -44,4 +44,4 @@ export type EventValidationConfig = {
|
|
|
44
44
|
* - URI and version compatibility checks
|
|
45
45
|
* - Schema-based data validation
|
|
46
46
|
*/
|
|
47
|
-
export declare function validateInputEvent({ event, selfContract
|
|
47
|
+
export declare function validateInputEvent({ event, selfContract, serviceContracts, span, }: EventValidationConfig): EventValidationResult;
|
|
@@ -22,7 +22,7 @@ var arvo_core_1 = require("arvo-core");
|
|
|
22
22
|
*/
|
|
23
23
|
function validateInputEvent(_a) {
|
|
24
24
|
var _b;
|
|
25
|
-
var event = _a.event,
|
|
25
|
+
var event = _a.event, selfContract = _a.selfContract, serviceContracts = _a.serviceContracts, span = _a.span;
|
|
26
26
|
var resolvedContract = null;
|
|
27
27
|
var contractType;
|
|
28
28
|
var parsedEventDataSchema = arvo_core_1.EventDataschemaUtil.parse(event);
|
|
@@ -37,26 +37,10 @@ function validateInputEvent(_a) {
|
|
|
37
37
|
error: new Error(errorMessage),
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
var selfContract;
|
|
41
|
-
if (
|
|
42
|
-
selfContract = _selfContract;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
if (!_selfContract.versions[parsedEventDataSchema.version]) {
|
|
46
|
-
var errorMessage = "Contract resolution failed: No matching contract found for event (id='".concat(event.id, "', type='").concat(event.type, "', dataschema='").concat(event.dataschema, "')");
|
|
47
|
-
(0, arvo_core_1.logToSpan)({
|
|
48
|
-
level: 'WARNING',
|
|
49
|
-
message: errorMessage,
|
|
50
|
-
}, span);
|
|
51
|
-
return {
|
|
52
|
-
type: 'CONTRACT_UNRESOLVED',
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
selfContract = _selfContract.version(parsedEventDataSchema.version);
|
|
56
|
-
}
|
|
57
|
-
if (event.type === selfContract.accepts.type) {
|
|
40
|
+
var selfType = selfContract instanceof arvo_core_1.VersionedArvoContract ? selfContract.accepts.type : selfContract.type;
|
|
41
|
+
if (event.type === selfType) {
|
|
58
42
|
contractType = 'self';
|
|
59
|
-
resolvedContract = selfContract;
|
|
43
|
+
resolvedContract = selfContract instanceof arvo_core_1.VersionedArvoContract ? selfContract : selfContract.version(parsedEventDataSchema.version);
|
|
60
44
|
}
|
|
61
45
|
else {
|
|
62
46
|
contractType = 'service';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arvo-event-handler",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "Type-safe event handler system with versioning, telemetry, and contract validation for distributed Arvo event-driven architectures, featuring routing and multi-handler support.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@opentelemetry/api": "^1.9.0",
|
|
48
48
|
"@opentelemetry/core": "^1.30.1",
|
|
49
|
-
"arvo-core": "^3.0.
|
|
49
|
+
"arvo-core": "^3.0.17",
|
|
50
50
|
"uuid": "^11.1.0",
|
|
51
51
|
"xstate": "^5.23.0",
|
|
52
52
|
"zod": "^3.25.74",
|