arvo-core 2.1.4 → 2.1.6
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/ArvoEventFactory/Orchestrator.js +5 -2
- package/dist/ArvoEventFactory/index.js +7 -3
- package/dist/ArvoEventFactory/utils.d.ts +13 -0
- package/dist/ArvoEventFactory/utils.js +24 -0
- package/dist/OpenTelemetry/OpenInference/types.d.ts +2 -1
- package/dist/OpenTelemetry/OpenInference/types.js +1 -0
- package/dist/utils.d.ts +3 -2
- package/package.json +1 -1
@@ -36,6 +36,7 @@ var schema_1 = require("../ArvoEvent/schema");
|
|
36
36
|
var OpenTelemetry_1 = require("../OpenTelemetry");
|
37
37
|
var utils_1 = require("../utils");
|
38
38
|
var ArvoOrchestrationSubject_1 = __importDefault(require("../ArvoOrchestrationSubject"));
|
39
|
+
var utils_2 = require("./utils");
|
39
40
|
/**
|
40
41
|
* Factory class for creating and validating orchestrator-specific events with managed subject hierarchies.
|
41
42
|
* Extends ArvoEventFactory with parent-child subject relationship handling and orchestration flows.
|
@@ -73,7 +74,8 @@ var ArvoOrchestratorEventFactory = /** @class */ (function (_super) {
|
|
73
74
|
ArvoOrchestratorEventFactory.prototype.init = function (event, extensions) {
|
74
75
|
var _this = this;
|
75
76
|
return OpenTelemetry_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
|
76
|
-
name: "".concat(this._name, "
|
77
|
+
name: "".concat(this._name, ".init"),
|
78
|
+
spanOptions: (0, utils_2.createSpanOptions)(this.contract),
|
77
79
|
fn: function (span) {
|
78
80
|
var _a, _b, _c, _d;
|
79
81
|
var otelHeaders = (0, OpenTelemetry_1.currentOpenTelemetryHeaders)();
|
@@ -112,7 +114,8 @@ var ArvoOrchestratorEventFactory = /** @class */ (function (_super) {
|
|
112
114
|
ArvoOrchestratorEventFactory.prototype.complete = function (event, extensions) {
|
113
115
|
var _this = this;
|
114
116
|
return OpenTelemetry_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
|
115
|
-
name: "".concat(this._name, "
|
117
|
+
name: "".concat(this._name, ".complete"),
|
118
|
+
spanOptions: (0, utils_2.createSpanOptions)(this.contract),
|
116
119
|
fn: function (span) {
|
117
120
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
118
121
|
var otelHeaders = (0, OpenTelemetry_1.currentOpenTelemetryHeaders)();
|
@@ -26,6 +26,7 @@ var helpers_1 = require("../ArvoEvent/helpers");
|
|
26
26
|
var schema_1 = require("../ArvoEvent/schema");
|
27
27
|
var OpenTelemetry_1 = require("../OpenTelemetry");
|
28
28
|
var utils_1 = require("../utils");
|
29
|
+
var utils_2 = require("./utils");
|
29
30
|
/**
|
30
31
|
* Factory class for creating and validating events based on a versioned Arvo contract.
|
31
32
|
* Handles event creation, validation, and OpenTelemetry integration for a specific
|
@@ -73,7 +74,8 @@ var ArvoEventFactory = /** @class */ (function () {
|
|
73
74
|
ArvoEventFactory.prototype.accepts = function (event, extensions) {
|
74
75
|
var _this = this;
|
75
76
|
return OpenTelemetry_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
|
76
|
-
name: "".concat(this._name, "
|
77
|
+
name: "".concat(this._name, ".accepts"),
|
78
|
+
spanOptions: (0, utils_2.createSpanOptions)(this.contract),
|
77
79
|
fn: function (span) {
|
78
80
|
var _a, _b, _c, _d;
|
79
81
|
var otelHeaders = (0, OpenTelemetry_1.currentOpenTelemetryHeaders)();
|
@@ -109,7 +111,8 @@ var ArvoEventFactory = /** @class */ (function () {
|
|
109
111
|
ArvoEventFactory.prototype.emits = function (event, extensions) {
|
110
112
|
var _this = this;
|
111
113
|
return OpenTelemetry_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
|
112
|
-
name: "".concat(this._name, "
|
114
|
+
name: "".concat(this._name, ".emits<").concat(event.type, ">"),
|
115
|
+
spanOptions: (0, utils_2.createSpanOptions)(this.contract),
|
113
116
|
fn: function (span) {
|
114
117
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
115
118
|
var otelHeaders = (0, OpenTelemetry_1.currentOpenTelemetryHeaders)();
|
@@ -146,7 +149,8 @@ var ArvoEventFactory = /** @class */ (function () {
|
|
146
149
|
ArvoEventFactory.prototype.systemError = function (event, extensions) {
|
147
150
|
var _this = this;
|
148
151
|
return OpenTelemetry_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
|
149
|
-
name: "".concat(this._name, "
|
152
|
+
name: "".concat(this._name, ".systemError"),
|
153
|
+
spanOptions: (0, utils_2.createSpanOptions)(this.contract),
|
150
154
|
fn: function (span) {
|
151
155
|
var _a, _b, _c, _d, _e;
|
152
156
|
var otelHeaders = (0, OpenTelemetry_1.currentOpenTelemetryHeaders)();
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { SpanKind } from "@opentelemetry/api";
|
2
|
+
import { VersionedArvoContract } from "../ArvoContract/VersionedArvoContract";
|
3
|
+
import { ArvoExecutionSpanKind } from "../OpenTelemetry/ArvoExecution/types";
|
4
|
+
import { OpenInferenceSpanKind } from "../OpenTelemetry/OpenInference/types";
|
5
|
+
export declare const createSpanOptions: (contract: VersionedArvoContract<any, any>) => {
|
6
|
+
kind: SpanKind;
|
7
|
+
attributes: {
|
8
|
+
"arvo.span.kind": ArvoExecutionSpanKind;
|
9
|
+
"openinference.span.kind": OpenInferenceSpanKind;
|
10
|
+
'arvo.contract.uri': any;
|
11
|
+
'arvo.contract.version': any;
|
12
|
+
};
|
13
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.createSpanOptions = void 0;
|
7
|
+
var api_1 = require("@opentelemetry/api");
|
8
|
+
var ArvoExecution_1 = __importDefault(require("../OpenTelemetry/ArvoExecution"));
|
9
|
+
var OpenInference_1 = __importDefault(require("../OpenTelemetry/OpenInference"));
|
10
|
+
var types_1 = require("../OpenTelemetry/ArvoExecution/types");
|
11
|
+
var types_2 = require("../OpenTelemetry/OpenInference/types");
|
12
|
+
var createSpanOptions = function (contract) {
|
13
|
+
var _a;
|
14
|
+
return ({
|
15
|
+
kind: api_1.SpanKind.INTERNAL,
|
16
|
+
attributes: (_a = {},
|
17
|
+
_a[ArvoExecution_1.default.ATTR_SPAN_KIND] = types_1.ArvoExecutionSpanKind.INTERNAL,
|
18
|
+
_a[OpenInference_1.default.ATTR_SPAN_KIND] = types_2.OpenInferenceSpanKind.INTERNAL,
|
19
|
+
_a['arvo.contract.uri'] = contract.uri,
|
20
|
+
_a['arvo.contract.version'] = contract.version,
|
21
|
+
_a)
|
22
|
+
});
|
23
|
+
};
|
24
|
+
exports.createSpanOptions = createSpanOptions;
|
@@ -15,4 +15,5 @@ var OpenInferenceSpanKind;
|
|
15
15
|
OpenInferenceSpanKind["TOOL"] = "TOOL";
|
16
16
|
OpenInferenceSpanKind["GUARDRAIL"] = "GUARDRAIL";
|
17
17
|
OpenInferenceSpanKind["EVALUATOR"] = "EVALUATOR";
|
18
|
+
OpenInferenceSpanKind["INTERNAL"] = "INTERNAL";
|
18
19
|
})(OpenInferenceSpanKind || (exports.OpenInferenceSpanKind = OpenInferenceSpanKind = {}));
|
package/dist/utils.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { VersionedArvoContract } from './ArvoContract/VersionedArvoContract';
|
2
|
+
import { WildCardArvoSemanticVersion } from './ArvoContract/WildCardArvoSemanticVersion';
|
2
3
|
import ArvoEvent from './ArvoEvent';
|
3
4
|
import { ArvoSemanticVersion } from './types';
|
4
5
|
/**
|
@@ -88,13 +89,13 @@ export declare class EventDataschemaUtil {
|
|
88
89
|
* // Returns: "my-contract/1.0.0"
|
89
90
|
* ```
|
90
91
|
*/
|
91
|
-
static create
|
92
|
+
static create<T extends VersionedArvoContract<any, any>>(contract: T): `${T['uri']}/${T['version']}`;
|
92
93
|
/**
|
93
94
|
* Creates dataschema string with wildcard version.
|
94
95
|
* @param contract Versioned contract
|
95
96
|
* @returns `{contract.uri}/{WildCardArvoSemanticVersion}`
|
96
97
|
*/
|
97
|
-
static createWithWildCardVersion
|
98
|
+
static createWithWildCardVersion<T extends VersionedArvoContract<any, any>>(contract: T): `${T['uri']}/${typeof WildCardArvoSemanticVersion}`;
|
98
99
|
/**
|
99
100
|
* Extracts URI and version from dataschema string.
|
100
101
|
*
|