arvo-event-handler 3.0.15 → 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.
|
@@ -78,7 +78,7 @@ var createEmittableEvent = function (_a, span) {
|
|
|
78
78
|
arvo_core_1.ArvoOrchestrationSubject.parse(event.data.parentSubject$$);
|
|
79
79
|
}
|
|
80
80
|
catch (_o) {
|
|
81
|
-
throw new errors_1.ExecutionViolation("Invalid parentSubject$$ for the event(type='".concat(event.type, "', uri='").concat((_b = event.dataschema) !== null && _b !== void 0 ? _b : arvo_core_1.EventDataschemaUtil.create(contract), "'). It must be follow the ArvoOrchestrationSubject schema. The easiest way is to use the current orchestration subject by storing the subject via the context block in the machine definition."));
|
|
81
|
+
throw new errors_1.ExecutionViolation("[Emittable Event Creation] Invalid parentSubject$$ for the event(type='".concat(event.type, "', uri='").concat((_b = event.dataschema) !== null && _b !== void 0 ? _b : arvo_core_1.EventDataschemaUtil.create(contract), "'). It must be follow the ArvoOrchestrationSubject schema. The easiest way is to use the current orchestration subject by storing the subject via the context block in the machine definition."));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
try {
|
|
@@ -106,7 +106,7 @@ var createEmittableEvent = function (_a, span) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
catch (error) {
|
|
109
|
-
throw new errors_1.ExecutionViolation("Orchestration subject creation failed due to invalid parameters - Event: ".concat(event.type, " - ").concat(error === null || error === void 0 ? void 0 : error.message));
|
|
109
|
+
throw new errors_1.ExecutionViolation("[Emittable Event Creation] Orchestration subject creation failed due to invalid parameters - Event: ".concat(event.type, " - ").concat(error === null || error === void 0 ? void 0 : error.message));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -118,7 +118,7 @@ var createEmittableEvent = function (_a, span) {
|
|
|
118
118
|
finalDataschema = arvo_core_1.EventDataschemaUtil.create(contract);
|
|
119
119
|
}
|
|
120
120
|
catch (error) {
|
|
121
|
-
throw new errors_1.ContractViolation("Invalid event data: Schema validation failed.\nEvent type: ".concat(event.type, "\nDetails: ").concat(error.message));
|
|
121
|
+
throw new errors_1.ContractViolation("[Emittable Event Creation] Invalid event data: Schema validation failed.\nEvent type: ".concat(event.type, "\nDetails: ").concat(error.message));
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
var emittableEvent = (0, arvo_core_1.createArvoEvent)({
|
|
@@ -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",
|