arvo-core 1.1.0 → 1.1.2
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/CHANGELOG.md +4 -0
- package/dist/ArvoEvent/helpers.d.ts +2 -1
- package/dist/ArvoEvent/helpers.js +3 -2
- package/dist/ArvoEvent/index.d.ts +23 -31
- package/dist/ArvoEvent/index.js +53 -43
- package/dist/ArvoEventHttp/index.d.ts +33 -0
- package/dist/ArvoEventHttp/index.js +199 -0
- package/dist/ArvoEventHttp/types.d.ts +9 -0
- package/dist/ArvoEventHttp/types.js +2 -0
- package/dist/ArvoOrchestrationSubject/index.d.ts +1 -1
- package/dist/ArvoOrchestrationSubject/index.js +2 -2
- package/dist/ArvoOrchestrationSubject/schema.d.ts +1 -1
- package/dist/ArvoOrchestrationSubject/schema.js +10 -5
- package/dist/OpenTelemetry/ArvoExecution/index.js +1 -1
- package/dist/OpenTelemetry/OpenInference/index.js +55 -55
- package/dist/OpenTelemetry/index.js +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -22,6 +22,7 @@ import { ArvoEventData, CloudEventExtension, CreateArvoEvent } from './types';
|
|
22
22
|
* - If no `datacontenttype` is provided, it defaults to `application/cloudevents+json;charset=UTF-8;profile=arvo`.
|
23
23
|
* - If a non-compatible `datacontenttype` is provided, a warning will be logged to the span.
|
24
24
|
* - The `source`, `subject`, `to`, `redirectto`, and `dataschema` fields are URI-encoded.
|
25
|
+
* - If no `to` (null, undefined or empty string) is provided, then the `type` value is used by default
|
25
26
|
*
|
26
27
|
* @example
|
27
28
|
* const event = createArvoEvent(
|
@@ -31,7 +32,7 @@ import { ArvoEventData, CloudEventExtension, CreateArvoEvent } from './types';
|
|
31
32
|
* subject: 'example-subject',
|
32
33
|
* data: { key: 'value' }
|
33
34
|
* },
|
34
|
-
* {
|
35
|
+
* { customextension: 'value' },
|
35
36
|
* );
|
36
37
|
*/
|
37
38
|
export declare const createArvoEvent: <TData extends ArvoEventData, TExtension extends CloudEventExtension, TType extends string>(event: CreateArvoEvent<TData, TType>, extensions?: TExtension) => ArvoEvent<TData, TExtension, TType>;
|
@@ -32,6 +32,7 @@ var uuid_1 = require("uuid");
|
|
32
32
|
* - If no `datacontenttype` is provided, it defaults to `application/cloudevents+json;charset=UTF-8;profile=arvo`.
|
33
33
|
* - If a non-compatible `datacontenttype` is provided, a warning will be logged to the span.
|
34
34
|
* - The `source`, `subject`, `to`, `redirectto`, and `dataschema` fields are URI-encoded.
|
35
|
+
* - If no `to` (null, undefined or empty string) is provided, then the `type` value is used by default
|
35
36
|
*
|
36
37
|
* @example
|
37
38
|
* const event = createArvoEvent(
|
@@ -41,7 +42,7 @@ var uuid_1 = require("uuid");
|
|
41
42
|
* subject: 'example-subject',
|
42
43
|
* data: { key: 'value' }
|
43
44
|
* },
|
44
|
-
* {
|
45
|
+
* { customextension: 'value' },
|
45
46
|
* );
|
46
47
|
*/
|
47
48
|
var createArvoEvent = function (event, extensions) {
|
@@ -70,7 +71,7 @@ var createArvoEvent = function (event, extensions) {
|
|
70
71
|
time: (_h = event.time) !== null && _h !== void 0 ? _h : (0, utils_1.createTimestamp)(),
|
71
72
|
source: encodeURI(event.source),
|
72
73
|
subject: encodeURI(event.subject),
|
73
|
-
to: event.to ? encodeURI(event.to) :
|
74
|
+
to: event.to ? encodeURI(event.to) : encodeURI(event.type),
|
74
75
|
redirectto: event.redirectto ? encodeURI(event.redirectto) : null,
|
75
76
|
dataschema: event.dataschema ? encodeURI(event.dataschema) : null,
|
76
77
|
}, event.data, extensions);
|
@@ -15,7 +15,7 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
15
15
|
readonly dataschema: string | null;
|
16
16
|
readonly data: TData;
|
17
17
|
readonly time: string;
|
18
|
-
readonly
|
18
|
+
private readonly _extensions;
|
19
19
|
/**
|
20
20
|
* Creates an instance of ArvoEvent.
|
21
21
|
* @param context - The CloudEvent context along with Arvo and OpenTelemetry extensions.
|
@@ -56,7 +56,16 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
56
56
|
};
|
57
57
|
/**
|
58
58
|
* Converts the ArvoEvent to a JSON-serializable object.
|
59
|
-
*
|
59
|
+
* It bundles the extensions and the cloudevent fields into
|
60
|
+
* one object.
|
61
|
+
*
|
62
|
+
* @remarks
|
63
|
+
* This method combines the default CloudEvent fields and all extensions
|
64
|
+
* (including Arvo and OpenTelemetry extensions) into a single object.
|
65
|
+
* If you need to access the CloudEvent fields and extensions separately,
|
66
|
+
* use the `cloudevent` getter instead.
|
67
|
+
*
|
68
|
+
* @returns A plain object representation of the ArvoEvent, including all fields and extensions.
|
60
69
|
*/
|
61
70
|
toJSON(): Record<string, any>;
|
62
71
|
/**
|
@@ -90,66 +99,49 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
90
99
|
* Gets the 'to' field from the ArvoExtension.
|
91
100
|
* This field represents the intended recipient or destination of the event.
|
92
101
|
* @returns The value of the 'to' field.
|
93
|
-
*
|
94
|
-
* @remarks
|
95
|
-
* This is a convenience getter for the data in `this.extensions.to` as this
|
96
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
97
|
-
* spec.
|
98
102
|
*/
|
99
103
|
get to(): string | null;
|
100
104
|
/**
|
101
105
|
* Gets the 'accesscontrol' field from the ArvoExtension.
|
102
106
|
* This field contains access control information for the event.
|
103
107
|
* @returns The value of the 'accesscontrol' field.
|
104
|
-
*
|
105
|
-
* @remarks
|
106
|
-
* This is a convenience getter for the data in `this.extensions.accesscontrol` as this
|
107
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
108
|
-
* spec.
|
109
108
|
*/
|
110
109
|
get accesscontrol(): string | null;
|
111
110
|
/**
|
112
111
|
* Gets the 'redirectto' field from the ArvoExtension.
|
113
112
|
* This field indicate an alternative destination for the event.
|
114
113
|
* @returns The value of the 'redirectto' field.
|
115
|
-
*
|
116
|
-
* @remarks
|
117
|
-
* This is a convenience getter for the data in `this.extensions.redirectto` as this
|
118
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
119
|
-
* spec.
|
120
114
|
*/
|
121
115
|
get redirectto(): string | null;
|
122
116
|
/**
|
123
117
|
* Gets the 'executionunits' field from the ArvoExtension.
|
124
118
|
* This field contains information about the execution units associated with the event.
|
125
119
|
* @returns The value of the 'executionunits' field.
|
126
|
-
*
|
127
|
-
* @remarks
|
128
|
-
* This is a convenience getter for the data in `this.extensions.executionunits` as this
|
129
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
130
|
-
* spec.
|
131
120
|
*/
|
132
121
|
get executionunits(): number | null;
|
133
122
|
/**
|
134
123
|
* Gets the 'traceparent' field from the OpenTelemetryExtension.
|
135
124
|
* This field contains the W3C Trace Context traceparent header.
|
136
125
|
* @returns The value of the 'traceparent' field.
|
137
|
-
*
|
138
|
-
* @remarks
|
139
|
-
* This is a convenience getter for the data in `this.extensions.traceparent` as this
|
140
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
141
|
-
* spec.
|
142
126
|
*/
|
143
127
|
get traceparent(): string | null;
|
144
128
|
/**
|
145
129
|
* Gets the 'tracestate' field from the OpenTelemetryExtension.
|
146
130
|
* This field contains the W3C Trace Context tracestate header.
|
147
131
|
* @returns The value of the 'tracestate' field, or undefined if not set.
|
132
|
+
*/
|
133
|
+
get tracestate(): string | null;
|
134
|
+
/**
|
135
|
+
* Gets the custom extensions of the ArvoEvent.
|
148
136
|
*
|
149
137
|
* @remarks
|
150
|
-
* This
|
151
|
-
*
|
152
|
-
*
|
138
|
+
* This getter returns only the custom extensions (TExtension) added to the ArvoEvent,
|
139
|
+
* excluding the standard Arvo and OpenTelemetry extensions.
|
140
|
+
* For accessing all extensions including Arvo and OpenTelemetry,
|
141
|
+
* use `<ArvoEvent>.cloudevent.extensions`.
|
142
|
+
* For accessing the basic CloudEvent fields, use `<ArvoEvent>.cloudevent.default`.
|
143
|
+
*
|
144
|
+
* @returns An object containing only the custom extensions (TExtension) of the ArvoEvent.
|
153
145
|
*/
|
154
|
-
get
|
146
|
+
get extensions(): TExtension;
|
155
147
|
}
|
package/dist/ArvoEvent/index.js
CHANGED
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
};
|
11
11
|
return __assign.apply(this, arguments);
|
12
12
|
};
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
14
|
+
var t = {};
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
16
|
+
t[p] = s[p];
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
20
|
+
t[p[i]] = s[p[i]];
|
21
|
+
}
|
22
|
+
return t;
|
23
|
+
};
|
13
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
25
|
var schema_1 = require("./schema");
|
15
26
|
var OpenTelemetry_1 = require("../OpenTelemetry");
|
@@ -39,16 +50,16 @@ var ArvoEvent = /** @class */ (function () {
|
|
39
50
|
this.data = schema_1.ArvoDataSchema.parse(data);
|
40
51
|
var arvoExtension = schema_1.ArvoExtensionSchema.parse(context);
|
41
52
|
var otelExtension = schema_1.OpenTelemetryExtensionSchema.parse(context);
|
42
|
-
this.
|
53
|
+
this._extensions = __assign(__assign({}, (extensions
|
43
54
|
? schema_1.CloudEventExtensionSchema.parse(extensions)
|
44
55
|
: {})), { to: arvoExtension.to, accesscontrol: arvoExtension.accesscontrol, redirectto: arvoExtension.redirectto, executionunits: arvoExtension.executionunits, traceparent: otelExtension.traceparent, tracestate: otelExtension.tracestate });
|
45
56
|
if (this.datacontenttype === schema_1.ArvoDataContentType) {
|
46
|
-
if (!this.
|
57
|
+
if (!this._extensions.to) {
|
47
58
|
throw new Error("The ArvoEvent must have a non-empty 'to' field");
|
48
59
|
}
|
49
60
|
}
|
50
61
|
Object.freeze(this);
|
51
|
-
Object.freeze(this.
|
62
|
+
Object.freeze(this._extensions);
|
52
63
|
}
|
53
64
|
Object.defineProperty(ArvoEvent.prototype, "cloudevent", {
|
54
65
|
/**
|
@@ -73,7 +84,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
73
84
|
data: this.data,
|
74
85
|
time: this.time,
|
75
86
|
},
|
76
|
-
extensions: this.
|
87
|
+
extensions: __assign({}, this._extensions),
|
77
88
|
};
|
78
89
|
},
|
79
90
|
enumerable: false,
|
@@ -81,10 +92,19 @@ var ArvoEvent = /** @class */ (function () {
|
|
81
92
|
});
|
82
93
|
/**
|
83
94
|
* Converts the ArvoEvent to a JSON-serializable object.
|
84
|
-
*
|
95
|
+
* It bundles the extensions and the cloudevent fields into
|
96
|
+
* one object.
|
97
|
+
*
|
98
|
+
* @remarks
|
99
|
+
* This method combines the default CloudEvent fields and all extensions
|
100
|
+
* (including Arvo and OpenTelemetry extensions) into a single object.
|
101
|
+
* If you need to access the CloudEvent fields and extensions separately,
|
102
|
+
* use the `cloudevent` getter instead.
|
103
|
+
*
|
104
|
+
* @returns A plain object representation of the ArvoEvent, including all fields and extensions.
|
85
105
|
*/
|
86
106
|
ArvoEvent.prototype.toJSON = function () {
|
87
|
-
return __assign(__assign({}, this.cloudevent.default), this.
|
107
|
+
return __assign(__assign({}, this.cloudevent.default), this._extensions);
|
88
108
|
};
|
89
109
|
/**
|
90
110
|
* Converts the ArvoEvent to a JSON string.
|
@@ -115,9 +135,9 @@ var ArvoEvent = /** @class */ (function () {
|
|
115
135
|
'cloudevents.event_time': this.time || OpenTelemetry_1.OTelNull,
|
116
136
|
'cloudevents.event_datacontenttype': this.datacontenttype || OpenTelemetry_1.OTelNull,
|
117
137
|
'cloudevents.event_dataschema': (_a = this.dataschema) !== null && _a !== void 0 ? _a : OpenTelemetry_1.OTelNull,
|
118
|
-
'cloudevents.arvo.event_redirectto': (_b = this.
|
119
|
-
'cloudevents.arvo.event_to': (_c = this.
|
120
|
-
'cloudevents.arvo.event_executionunits': (_d = this.
|
138
|
+
'cloudevents.arvo.event_redirectto': (_b = this._extensions.redirectto) !== null && _b !== void 0 ? _b : OpenTelemetry_1.OTelNull,
|
139
|
+
'cloudevents.arvo.event_to': (_c = this._extensions.to) !== null && _c !== void 0 ? _c : OpenTelemetry_1.OTelNull,
|
140
|
+
'cloudevents.arvo.event_executionunits': (_d = this._extensions.executionunits) !== null && _d !== void 0 ? _d : OpenTelemetry_1.OTelNull,
|
121
141
|
};
|
122
142
|
},
|
123
143
|
enumerable: false,
|
@@ -128,14 +148,9 @@ var ArvoEvent = /** @class */ (function () {
|
|
128
148
|
* Gets the 'to' field from the ArvoExtension.
|
129
149
|
* This field represents the intended recipient or destination of the event.
|
130
150
|
* @returns The value of the 'to' field.
|
131
|
-
*
|
132
|
-
* @remarks
|
133
|
-
* This is a convenience getter for the data in `this.extensions.to` as this
|
134
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
135
|
-
* spec.
|
136
151
|
*/
|
137
152
|
get: function () {
|
138
|
-
return this.
|
153
|
+
return this._extensions.to;
|
139
154
|
},
|
140
155
|
enumerable: false,
|
141
156
|
configurable: true
|
@@ -145,14 +160,9 @@ var ArvoEvent = /** @class */ (function () {
|
|
145
160
|
* Gets the 'accesscontrol' field from the ArvoExtension.
|
146
161
|
* This field contains access control information for the event.
|
147
162
|
* @returns The value of the 'accesscontrol' field.
|
148
|
-
*
|
149
|
-
* @remarks
|
150
|
-
* This is a convenience getter for the data in `this.extensions.accesscontrol` as this
|
151
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
152
|
-
* spec.
|
153
163
|
*/
|
154
164
|
get: function () {
|
155
|
-
return this.
|
165
|
+
return this._extensions.accesscontrol;
|
156
166
|
},
|
157
167
|
enumerable: false,
|
158
168
|
configurable: true
|
@@ -162,14 +172,9 @@ var ArvoEvent = /** @class */ (function () {
|
|
162
172
|
* Gets the 'redirectto' field from the ArvoExtension.
|
163
173
|
* This field indicate an alternative destination for the event.
|
164
174
|
* @returns The value of the 'redirectto' field.
|
165
|
-
*
|
166
|
-
* @remarks
|
167
|
-
* This is a convenience getter for the data in `this.extensions.redirectto` as this
|
168
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
169
|
-
* spec.
|
170
175
|
*/
|
171
176
|
get: function () {
|
172
|
-
return this.
|
177
|
+
return this._extensions.redirectto;
|
173
178
|
},
|
174
179
|
enumerable: false,
|
175
180
|
configurable: true
|
@@ -179,14 +184,9 @@ var ArvoEvent = /** @class */ (function () {
|
|
179
184
|
* Gets the 'executionunits' field from the ArvoExtension.
|
180
185
|
* This field contains information about the execution units associated with the event.
|
181
186
|
* @returns The value of the 'executionunits' field.
|
182
|
-
*
|
183
|
-
* @remarks
|
184
|
-
* This is a convenience getter for the data in `this.extensions.executionunits` as this
|
185
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
186
|
-
* spec.
|
187
187
|
*/
|
188
188
|
get: function () {
|
189
|
-
return this.
|
189
|
+
return this._extensions.executionunits;
|
190
190
|
},
|
191
191
|
enumerable: false,
|
192
192
|
configurable: true
|
@@ -196,14 +196,9 @@ var ArvoEvent = /** @class */ (function () {
|
|
196
196
|
* Gets the 'traceparent' field from the OpenTelemetryExtension.
|
197
197
|
* This field contains the W3C Trace Context traceparent header.
|
198
198
|
* @returns The value of the 'traceparent' field.
|
199
|
-
*
|
200
|
-
* @remarks
|
201
|
-
* This is a convenience getter for the data in `this.extensions.traceparent` as this
|
202
|
-
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
203
|
-
* spec.
|
204
199
|
*/
|
205
200
|
get: function () {
|
206
|
-
return this.
|
201
|
+
return this._extensions.traceparent;
|
207
202
|
},
|
208
203
|
enumerable: false,
|
209
204
|
configurable: true
|
@@ -213,14 +208,29 @@ var ArvoEvent = /** @class */ (function () {
|
|
213
208
|
* Gets the 'tracestate' field from the OpenTelemetryExtension.
|
214
209
|
* This field contains the W3C Trace Context tracestate header.
|
215
210
|
* @returns The value of the 'tracestate' field, or undefined if not set.
|
211
|
+
*/
|
212
|
+
get: function () {
|
213
|
+
return this._extensions.tracestate;
|
214
|
+
},
|
215
|
+
enumerable: false,
|
216
|
+
configurable: true
|
217
|
+
});
|
218
|
+
Object.defineProperty(ArvoEvent.prototype, "extensions", {
|
219
|
+
/**
|
220
|
+
* Gets the custom extensions of the ArvoEvent.
|
216
221
|
*
|
217
222
|
* @remarks
|
218
|
-
* This
|
219
|
-
*
|
220
|
-
*
|
223
|
+
* This getter returns only the custom extensions (TExtension) added to the ArvoEvent,
|
224
|
+
* excluding the standard Arvo and OpenTelemetry extensions.
|
225
|
+
* For accessing all extensions including Arvo and OpenTelemetry,
|
226
|
+
* use `<ArvoEvent>.cloudevent.extensions`.
|
227
|
+
* For accessing the basic CloudEvent fields, use `<ArvoEvent>.cloudevent.default`.
|
228
|
+
*
|
229
|
+
* @returns An object containing only the custom extensions (TExtension) of the ArvoEvent.
|
221
230
|
*/
|
222
231
|
get: function () {
|
223
|
-
|
232
|
+
var _a = this._extensions, traceparent = _a.traceparent, tracestate = _a.tracestate, to = _a.to, redirectto = _a.redirectto, accesscontrol = _a.accesscontrol, executionunits = _a.executionunits, rest = __rest(_a, ["traceparent", "tracestate", "to", "redirectto", "accesscontrol", "executionunits"]);
|
233
|
+
return rest;
|
224
234
|
},
|
225
235
|
enumerable: false,
|
226
236
|
configurable: true
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import ArvoEvent from '../ArvoEvent';
|
2
|
+
import { ArvoEventHttpConfig } from './types';
|
3
|
+
/**
|
4
|
+
* A utility class for converting ArvoEvents to and from HTTP configurations.
|
5
|
+
*/
|
6
|
+
export default class ArvoEventHttp {
|
7
|
+
/**
|
8
|
+
* Exports an ArvoEvent to a cloudevent binary-mode HTTP configuration.
|
9
|
+
* @param event - The ArvoEvent to export.
|
10
|
+
* @returns An ArvoEventHttpConfig object with headers and data.
|
11
|
+
*/
|
12
|
+
static exportToBinary(event: ArvoEvent): ArvoEventHttpConfig;
|
13
|
+
/**
|
14
|
+
* Exports an ArvoEvent to a cloudevent structured-mode HTTP representation.
|
15
|
+
* @param event - The ArvoEvent to export.
|
16
|
+
* @returns An ArvoEventHttpConfig object with headers and data.
|
17
|
+
*/
|
18
|
+
static exportToStructured(event: ArvoEvent): ArvoEventHttpConfig;
|
19
|
+
/**
|
20
|
+
* Imports an ArvoEvent from a binary-mode HTTP representation.
|
21
|
+
* @param config - The ArvoEventHttpConfig object to import from.
|
22
|
+
* @returns A new ArvoEvent instance.
|
23
|
+
* @throws {Error} If required fields are missing or if there's an error parsing the input.
|
24
|
+
*/
|
25
|
+
static importFromBinary(config: ArvoEventHttpConfig): ArvoEvent;
|
26
|
+
/**
|
27
|
+
* Imports an ArvoEvent from a structured-mode HTTP representation.
|
28
|
+
* @param config - The ArvoEventHttpConfig object to import from.
|
29
|
+
* @returns A new ArvoEvent instance.
|
30
|
+
* @throws {Error} If required fields are missing or if there's an error parsing the input.
|
31
|
+
*/
|
32
|
+
static importFromStructured(config: ArvoEventHttpConfig): ArvoEvent;
|
33
|
+
}
|
@@ -0,0 +1,199 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
14
|
+
var t = {};
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
16
|
+
t[p] = s[p];
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
20
|
+
t[p[i]] = s[p[i]];
|
21
|
+
}
|
22
|
+
return t;
|
23
|
+
};
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
25
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
26
|
+
if (ar || !(i in from)) {
|
27
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
28
|
+
ar[i] = from[i];
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
32
|
+
};
|
33
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
34
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
35
|
+
};
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
37
|
+
var ArvoEvent_1 = __importDefault(require("../ArvoEvent"));
|
38
|
+
var schema_1 = require("../ArvoEvent/schema");
|
39
|
+
var utils_1 = require("../utils");
|
40
|
+
var uuid_1 = require("uuid");
|
41
|
+
/**
|
42
|
+
* A utility class for converting ArvoEvents to and from HTTP configurations.
|
43
|
+
*/
|
44
|
+
var ArvoEventHttp = /** @class */ (function () {
|
45
|
+
function ArvoEventHttp() {
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* Exports an ArvoEvent to a cloudevent binary-mode HTTP configuration.
|
49
|
+
* @param event - The ArvoEvent to export.
|
50
|
+
* @returns An ArvoEventHttpConfig object with headers and data.
|
51
|
+
*/
|
52
|
+
ArvoEventHttp.exportToBinary = function (event) {
|
53
|
+
var headers = Object.assign.apply(Object, __spreadArray([{}], Object.entries(event.toJSON())
|
54
|
+
.filter(function (_a) {
|
55
|
+
var key = _a[0];
|
56
|
+
return key !== 'data';
|
57
|
+
})
|
58
|
+
.map(function (_a) {
|
59
|
+
var _b;
|
60
|
+
var key = _a[0], value = _a[1];
|
61
|
+
return (_b = {},
|
62
|
+
_b["ce-".concat(key)] = value,
|
63
|
+
_b);
|
64
|
+
}), false));
|
65
|
+
return {
|
66
|
+
headers: __assign(__assign({}, headers), { 'content-type': 'application/json' }),
|
67
|
+
data: __assign({}, event.data),
|
68
|
+
};
|
69
|
+
};
|
70
|
+
/**
|
71
|
+
* Exports an ArvoEvent to a cloudevent structured-mode HTTP representation.
|
72
|
+
* @param event - The ArvoEvent to export.
|
73
|
+
* @returns An ArvoEventHttpConfig object with headers and data.
|
74
|
+
*/
|
75
|
+
ArvoEventHttp.exportToStructured = function (event) {
|
76
|
+
return {
|
77
|
+
headers: {
|
78
|
+
'content-type': event.datacontenttype,
|
79
|
+
},
|
80
|
+
data: event.toJSON(),
|
81
|
+
};
|
82
|
+
};
|
83
|
+
/**
|
84
|
+
* Imports an ArvoEvent from a binary-mode HTTP representation.
|
85
|
+
* @param config - The ArvoEventHttpConfig object to import from.
|
86
|
+
* @returns A new ArvoEvent instance.
|
87
|
+
* @throws {Error} If required fields are missing or if there's an error parsing the input.
|
88
|
+
*/
|
89
|
+
ArvoEventHttp.importFromBinary = function (config) {
|
90
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
91
|
+
try {
|
92
|
+
if (config.headers['content-type'] !== 'application/json') {
|
93
|
+
throw new Error("Invalid content-type: ".concat(config.headers['content-type'], ". Expected: application/json"));
|
94
|
+
}
|
95
|
+
var eventFields = [
|
96
|
+
'id',
|
97
|
+
'type',
|
98
|
+
'accesscontrol',
|
99
|
+
'executionunits',
|
100
|
+
'traceparent',
|
101
|
+
'tracestate',
|
102
|
+
'datacontenttype',
|
103
|
+
'specversion',
|
104
|
+
'time',
|
105
|
+
'source',
|
106
|
+
'subject',
|
107
|
+
'to',
|
108
|
+
'redirectto',
|
109
|
+
'dataschema',
|
110
|
+
];
|
111
|
+
var event_1 = {};
|
112
|
+
// Extract event fields from headers
|
113
|
+
for (var _i = 0, eventFields_1 = eventFields; _i < eventFields_1.length; _i++) {
|
114
|
+
var field = eventFields_1[_i];
|
115
|
+
var headerKey = "ce-".concat(field);
|
116
|
+
if (headerKey in config.headers) {
|
117
|
+
event_1[field] = config.headers[headerKey];
|
118
|
+
}
|
119
|
+
}
|
120
|
+
// Validate required fields
|
121
|
+
if (!event_1.type || !event_1.source || !event_1.subject) {
|
122
|
+
throw new Error('Missing required header fields: ce-type, ce-source, or ce-subject');
|
123
|
+
}
|
124
|
+
// Extract extensions
|
125
|
+
var prefixedEventFields_1 = eventFields.map(function (item) { return "ce-".concat(item); });
|
126
|
+
var extensions = Object.entries(config.headers)
|
127
|
+
.filter(function (_a) {
|
128
|
+
var key = _a[0];
|
129
|
+
return key.startsWith('ce-') && !prefixedEventFields_1.includes(key);
|
130
|
+
})
|
131
|
+
.reduce(function (acc, _a) {
|
132
|
+
var key = _a[0], value = _a[1];
|
133
|
+
acc[key.slice(3)] = value;
|
134
|
+
return acc;
|
135
|
+
}, {});
|
136
|
+
// Create and return ArvoEvent
|
137
|
+
return new ArvoEvent_1.default({
|
138
|
+
id: (_a = event_1.id) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
|
139
|
+
type: event_1.type,
|
140
|
+
accesscontrol: (_b = event_1.accesscontrol) !== null && _b !== void 0 ? _b : null,
|
141
|
+
executionunits: event_1.executionunits
|
142
|
+
? Number(event_1.executionunits)
|
143
|
+
: null,
|
144
|
+
traceparent: (_c = event_1.traceparent) !== null && _c !== void 0 ? _c : null,
|
145
|
+
tracestate: (_d = event_1.tracestate) !== null && _d !== void 0 ? _d : null,
|
146
|
+
datacontenttype: (_e = event_1.datacontenttype) !== null && _e !== void 0 ? _e : schema_1.ArvoDataContentType,
|
147
|
+
specversion: (_f = event_1.specversion) !== null && _f !== void 0 ? _f : '1.0',
|
148
|
+
time: (_g = event_1.time) !== null && _g !== void 0 ? _g : (0, utils_1.createTimestamp)(),
|
149
|
+
source: event_1.source,
|
150
|
+
subject: event_1.subject,
|
151
|
+
to: (_h = event_1.to) !== null && _h !== void 0 ? _h : null,
|
152
|
+
redirectto: (_j = event_1.redirectto) !== null && _j !== void 0 ? _j : null,
|
153
|
+
dataschema: (_k = event_1.dataschema) !== null && _k !== void 0 ? _k : null,
|
154
|
+
}, config.data, extensions);
|
155
|
+
}
|
156
|
+
catch (error) {
|
157
|
+
throw new Error("Failed to import ArvoEvent from binary: ".concat(error.message));
|
158
|
+
}
|
159
|
+
};
|
160
|
+
/**
|
161
|
+
* Imports an ArvoEvent from a structured-mode HTTP representation.
|
162
|
+
* @param config - The ArvoEventHttpConfig object to import from.
|
163
|
+
* @returns A new ArvoEvent instance.
|
164
|
+
* @throws {Error} If required fields are missing or if there's an error parsing the input.
|
165
|
+
*/
|
166
|
+
ArvoEventHttp.importFromStructured = function (config) {
|
167
|
+
try {
|
168
|
+
if (config.headers['content-type'] !== schema_1.ArvoDataContentType) {
|
169
|
+
throw new Error("Invalid content-type: ".concat(config.headers['content-type'], ". Expected: ").concat(schema_1.ArvoDataContentType));
|
170
|
+
}
|
171
|
+
var eventData = config.data;
|
172
|
+
if (!eventData.type || !eventData.source || !eventData.subject) {
|
173
|
+
throw new Error('Missing required fields: type, source, or subject');
|
174
|
+
}
|
175
|
+
var id = eventData.id, type = eventData.type, source = eventData.source, subject = eventData.subject, time = eventData.time, datacontenttype = eventData.datacontenttype, specversion = eventData.specversion, dataschema = eventData.dataschema, data = eventData.data, to = eventData.to, accesscontrol = eventData.accesscontrol, redirectto = eventData.redirectto, executionunits = eventData.executionunits, traceparent = eventData.traceparent, tracestate = eventData.tracestate, extensions = __rest(eventData, ["id", "type", "source", "subject", "time", "datacontenttype", "specversion", "dataschema", "data", "to", "accesscontrol", "redirectto", "executionunits", "traceparent", "tracestate"]);
|
176
|
+
return new ArvoEvent_1.default({
|
177
|
+
id: id !== null && id !== void 0 ? id : (0, uuid_1.v4)(),
|
178
|
+
type: type,
|
179
|
+
source: source,
|
180
|
+
subject: subject,
|
181
|
+
time: time !== null && time !== void 0 ? time : (0, utils_1.createTimestamp)(),
|
182
|
+
datacontenttype: datacontenttype !== null && datacontenttype !== void 0 ? datacontenttype : schema_1.ArvoDataContentType,
|
183
|
+
specversion: specversion !== null && specversion !== void 0 ? specversion : '1.0',
|
184
|
+
dataschema: dataschema !== null && dataschema !== void 0 ? dataschema : null,
|
185
|
+
to: to !== null && to !== void 0 ? to : null,
|
186
|
+
accesscontrol: accesscontrol !== null && accesscontrol !== void 0 ? accesscontrol : null,
|
187
|
+
redirectto: redirectto !== null && redirectto !== void 0 ? redirectto : null,
|
188
|
+
executionunits: executionunits ? Number(executionunits) : null,
|
189
|
+
traceparent: traceparent !== null && traceparent !== void 0 ? traceparent : null,
|
190
|
+
tracestate: tracestate !== null && tracestate !== void 0 ? tracestate : null,
|
191
|
+
}, data !== null && data !== void 0 ? data : {}, extensions);
|
192
|
+
}
|
193
|
+
catch (error) {
|
194
|
+
throw new Error("Failed to import ArvoEvent from structured: ".concat(error.message));
|
195
|
+
}
|
196
|
+
};
|
197
|
+
return ArvoEventHttp;
|
198
|
+
}());
|
199
|
+
exports.default = ArvoEventHttp;
|
@@ -9,8 +9,10 @@ exports.ArvoOchestratorVersionSchema = zod_1.z
|
|
9
9
|
.refine(function (value) { return !value.includes(';'); }, 'Version must not contain semicolon')
|
10
10
|
.describe('Semantic version of the Arvo Orchestrator in the format X.Y.Z');
|
11
11
|
// Zod schema for ArvoOrchestrationSubjectContent
|
12
|
-
exports.ArvoOrchestrationSubjectContentSchema = zod_1.z
|
13
|
-
|
12
|
+
exports.ArvoOrchestrationSubjectContentSchema = zod_1.z
|
13
|
+
.object({
|
14
|
+
orchestrator: zod_1.z
|
15
|
+
.object({
|
14
16
|
name: zod_1.z
|
15
17
|
.string()
|
16
18
|
.regex(/^[a-z0-9]+(\.[a-z0-9]+)+\.[a-z0-9]+$/, 'Orchestrator name should be prefixed with a reverse-DNS name')
|
@@ -19,7 +21,8 @@ exports.ArvoOrchestrationSubjectContentSchema = zod_1.z.object({
|
|
19
21
|
version: exports.ArvoOchestratorVersionSchema,
|
20
22
|
})
|
21
23
|
.describe('Information about the orchestrator'),
|
22
|
-
execution: zod_1.z
|
24
|
+
execution: zod_1.z
|
25
|
+
.object({
|
23
26
|
id: zod_1.z
|
24
27
|
.string()
|
25
28
|
.min(1, 'ID must be a non-empty string')
|
@@ -30,5 +33,7 @@ exports.ArvoOrchestrationSubjectContentSchema = zod_1.z.object({
|
|
30
33
|
.regex(/^[a-z0-9]+(\.[a-z0-9]+)+\.[a-z0-9]+$/, 'Orchestration initiator should be prefixed with a reverse-DNS name')
|
31
34
|
.refine(function (value) { return !value.includes(';'); }, 'Initiator must not contain semicolon')
|
32
35
|
.describe('Entity or process that initiated the execution'),
|
33
|
-
})
|
34
|
-
|
36
|
+
})
|
37
|
+
.describe('Details about the current execution'),
|
38
|
+
})
|
39
|
+
.describe('Context information for Arvo orchestration');
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var ArvoExecution = /** @class */ (function () {
|
7
7
|
function ArvoExecution() {
|
8
8
|
}
|
9
|
-
ArvoExecution.ATTR_SPAN_KIND =
|
9
|
+
ArvoExecution.ATTR_SPAN_KIND = 'arvo.span.kind';
|
10
10
|
return ArvoExecution;
|
11
11
|
}());
|
12
12
|
exports.default = ArvoExecution;
|
@@ -8,78 +8,78 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
var OpenInference = /** @class */ (function () {
|
9
9
|
function OpenInference() {
|
10
10
|
}
|
11
|
-
OpenInference.ATTR_SPAN_KIND =
|
11
|
+
OpenInference.ATTR_SPAN_KIND = 'openinference.span.kind';
|
12
12
|
// Document attributes
|
13
|
-
OpenInference.ATTR_DOCUMENT_CONTENT =
|
14
|
-
OpenInference.ATTR_DOCUMENT_ID =
|
15
|
-
OpenInference.ATTR_DOCUMENT_METADATA =
|
16
|
-
OpenInference.ATTR_DOCUMENT_SCORE =
|
13
|
+
OpenInference.ATTR_DOCUMENT_CONTENT = 'document.content';
|
14
|
+
OpenInference.ATTR_DOCUMENT_ID = 'document.id';
|
15
|
+
OpenInference.ATTR_DOCUMENT_METADATA = 'document.metadata';
|
16
|
+
OpenInference.ATTR_DOCUMENT_SCORE = 'document.score';
|
17
17
|
// Embedding attributes
|
18
|
-
OpenInference.ATTR_EMBEDDING_EMBEDDINGS =
|
19
|
-
OpenInference.ATTR_EMBEDDING_MODEL_NAME =
|
20
|
-
OpenInference.ATTR_EMBEDDING_TEXT =
|
21
|
-
OpenInference.ATTR_EMBEDDING_VECTOR =
|
18
|
+
OpenInference.ATTR_EMBEDDING_EMBEDDINGS = 'embedding.embeddings';
|
19
|
+
OpenInference.ATTR_EMBEDDING_MODEL_NAME = 'embedding.model_name';
|
20
|
+
OpenInference.ATTR_EMBEDDING_TEXT = 'embedding.text';
|
21
|
+
OpenInference.ATTR_EMBEDDING_VECTOR = 'embedding.vector';
|
22
22
|
// Exception attributes
|
23
|
-
OpenInference.ATTR_EXCEPTION_ESCAPED =
|
24
|
-
OpenInference.ATTR_EXCEPTION_MESSAGE =
|
25
|
-
OpenInference.ATTR_EXCEPTION_STACKTRACE =
|
26
|
-
OpenInference.ATTR_EXCEPTION_TYPE =
|
23
|
+
OpenInference.ATTR_EXCEPTION_ESCAPED = 'exception.escaped';
|
24
|
+
OpenInference.ATTR_EXCEPTION_MESSAGE = 'exception.message';
|
25
|
+
OpenInference.ATTR_EXCEPTION_STACKTRACE = 'exception.stacktrace';
|
26
|
+
OpenInference.ATTR_EXCEPTION_TYPE = 'exception.type';
|
27
27
|
// Image attribute
|
28
|
-
OpenInference.ATTR_IMAGE_URL =
|
28
|
+
OpenInference.ATTR_IMAGE_URL = 'image.url';
|
29
29
|
// Input attributes
|
30
|
-
OpenInference.ATTR_INPUT_MIME_TYPE =
|
31
|
-
OpenInference.ATTR_INPUT_VALUE =
|
30
|
+
OpenInference.ATTR_INPUT_MIME_TYPE = 'input.mime_type';
|
31
|
+
OpenInference.ATTR_INPUT_VALUE = 'input.value';
|
32
32
|
// LLM attributes
|
33
|
-
OpenInference.ATTR_LLM_FUNCTION_CALL =
|
34
|
-
OpenInference.ATTR_LLM_INPUT_MESSAGES =
|
35
|
-
OpenInference.ATTR_LLM_INVOCATION_PARAMETERS =
|
36
|
-
OpenInference.ATTR_LLM_MODEL_NAME =
|
37
|
-
OpenInference.ATTR_LLM_OUTPUT_MESSAGES =
|
38
|
-
OpenInference.ATTR_LLM_PROMPT_TEMPLATE_TEMPLATE =
|
39
|
-
OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VARIABLES =
|
40
|
-
OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VERSION =
|
41
|
-
OpenInference.ATTR_LLM_TOKEN_COUNT_COMPLETION =
|
42
|
-
OpenInference.ATTR_LLM_TOKEN_COUNT_PROMPT =
|
43
|
-
OpenInference.ATTR_LLM_TOKEN_COUNT_TOTAL =
|
44
|
-
OpenInference.ATTR_LLM_TOOLS =
|
33
|
+
OpenInference.ATTR_LLM_FUNCTION_CALL = 'llm.function_call';
|
34
|
+
OpenInference.ATTR_LLM_INPUT_MESSAGES = 'llm.input_messages';
|
35
|
+
OpenInference.ATTR_LLM_INVOCATION_PARAMETERS = 'llm.invocation_parameters';
|
36
|
+
OpenInference.ATTR_LLM_MODEL_NAME = 'llm.model_name';
|
37
|
+
OpenInference.ATTR_LLM_OUTPUT_MESSAGES = 'llm.output_messages';
|
38
|
+
OpenInference.ATTR_LLM_PROMPT_TEMPLATE_TEMPLATE = 'llm.prompt_template.template';
|
39
|
+
OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VARIABLES = 'llm.prompt_template.variables';
|
40
|
+
OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VERSION = 'llm.prompt_template.version';
|
41
|
+
OpenInference.ATTR_LLM_TOKEN_COUNT_COMPLETION = 'llm.token_count.completion';
|
42
|
+
OpenInference.ATTR_LLM_TOKEN_COUNT_PROMPT = 'llm.token_count.prompt';
|
43
|
+
OpenInference.ATTR_LLM_TOKEN_COUNT_TOTAL = 'llm.token_count.total';
|
44
|
+
OpenInference.ATTR_LLM_TOOLS = 'llm.tools';
|
45
45
|
// Message attributes
|
46
|
-
OpenInference.ATTR_MESSAGE_CONTENT =
|
47
|
-
OpenInference.ATTR_MESSAGE_CONTENTS =
|
48
|
-
OpenInference.ATTR_MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON =
|
49
|
-
OpenInference.ATTR_MESSAGE_FUNCTION_CALL_NAME =
|
50
|
-
OpenInference.ATTR_MESSAGE_ROLE =
|
51
|
-
OpenInference.ATTR_MESSAGE_TOOL_CALLS =
|
46
|
+
OpenInference.ATTR_MESSAGE_CONTENT = 'message.content';
|
47
|
+
OpenInference.ATTR_MESSAGE_CONTENTS = 'message.contents';
|
48
|
+
OpenInference.ATTR_MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON = 'message.function_call_arguments_json';
|
49
|
+
OpenInference.ATTR_MESSAGE_FUNCTION_CALL_NAME = 'message.function_call_name';
|
50
|
+
OpenInference.ATTR_MESSAGE_ROLE = 'message.role';
|
51
|
+
OpenInference.ATTR_MESSAGE_TOOL_CALLS = 'message.tool_calls';
|
52
52
|
// Message content attributes
|
53
|
-
OpenInference.ATTR_MESSAGE_CONTENT_TYPE =
|
54
|
-
OpenInference.ATTR_MESSAGE_CONTENT_TEXT =
|
55
|
-
OpenInference.ATTR_MESSAGE_CONTENT_IMAGE =
|
53
|
+
OpenInference.ATTR_MESSAGE_CONTENT_TYPE = 'messagecontent.type';
|
54
|
+
OpenInference.ATTR_MESSAGE_CONTENT_TEXT = 'messagecontent.text';
|
55
|
+
OpenInference.ATTR_MESSAGE_CONTENT_IMAGE = 'messagecontent.image';
|
56
56
|
// Metadata attribute
|
57
|
-
OpenInference.ATTR_METADATA =
|
57
|
+
OpenInference.ATTR_METADATA = 'metadata';
|
58
58
|
// Output attributes
|
59
|
-
OpenInference.ATTR_OUTPUT_MIME_TYPE =
|
60
|
-
OpenInference.ATTR_OUTPUT_VALUE =
|
59
|
+
OpenInference.ATTR_OUTPUT_MIME_TYPE = 'output.mime_type';
|
60
|
+
OpenInference.ATTR_OUTPUT_VALUE = 'output.value';
|
61
61
|
// Reranker attributes
|
62
|
-
OpenInference.ATTR_RERANKER_INPUT_DOCUMENTS =
|
63
|
-
OpenInference.ATTR_RERANKER_MODEL_NAME =
|
64
|
-
OpenInference.ATTR_RERANKER_OUTPUT_DOCUMENTS =
|
65
|
-
OpenInference.ATTR_RERANKER_QUERY =
|
66
|
-
OpenInference.ATTR_RERANKER_TOP_K =
|
62
|
+
OpenInference.ATTR_RERANKER_INPUT_DOCUMENTS = 'reranker.input_documents';
|
63
|
+
OpenInference.ATTR_RERANKER_MODEL_NAME = 'reranker.model_name';
|
64
|
+
OpenInference.ATTR_RERANKER_OUTPUT_DOCUMENTS = 'reranker.output_documents';
|
65
|
+
OpenInference.ATTR_RERANKER_QUERY = 'reranker.query';
|
66
|
+
OpenInference.ATTR_RERANKER_TOP_K = 'reranker.top_k';
|
67
67
|
// Retrieval attribute
|
68
|
-
OpenInference.ATTR_RETRIEVAL_DOCUMENTS =
|
68
|
+
OpenInference.ATTR_RETRIEVAL_DOCUMENTS = 'retrieval.documents';
|
69
69
|
// Session attribute
|
70
|
-
OpenInference.ATTR_SESSION_ID =
|
70
|
+
OpenInference.ATTR_SESSION_ID = 'session.id';
|
71
71
|
// Tag attribute
|
72
|
-
OpenInference.ATTR_TAG_TAGS =
|
72
|
+
OpenInference.ATTR_TAG_TAGS = 'tag.tags';
|
73
73
|
// Tool attributes
|
74
|
-
OpenInference.ATTR_TOOL_DESCRIPTION =
|
75
|
-
OpenInference.ATTR_TOOL_JSON_SCHEMA =
|
76
|
-
OpenInference.ATTR_TOOL_NAME =
|
77
|
-
OpenInference.ATTR_TOOL_PARAMETERS =
|
74
|
+
OpenInference.ATTR_TOOL_DESCRIPTION = 'tool.description';
|
75
|
+
OpenInference.ATTR_TOOL_JSON_SCHEMA = 'tool.json_schema';
|
76
|
+
OpenInference.ATTR_TOOL_NAME = 'tool.name';
|
77
|
+
OpenInference.ATTR_TOOL_PARAMETERS = 'tool.parameters';
|
78
78
|
// Tool call attributes
|
79
|
-
OpenInference.ATTR_TOOL_CALL_FUNCTION_ARGUMENTS =
|
80
|
-
OpenInference.ATTR_TOOL_CALL_FUNCTION_NAME =
|
79
|
+
OpenInference.ATTR_TOOL_CALL_FUNCTION_ARGUMENTS = 'tool_call.function.arguments';
|
80
|
+
OpenInference.ATTR_TOOL_CALL_FUNCTION_NAME = 'tool_call.function.name';
|
81
81
|
// User attribute
|
82
|
-
OpenInference.ATTR_USER_ID =
|
82
|
+
OpenInference.ATTR_USER_ID = 'user.id';
|
83
83
|
return OpenInference;
|
84
84
|
}());
|
85
85
|
exports.default = OpenInference;
|
@@ -70,7 +70,7 @@ function currentOpenTelemetryHeaders() {
|
|
70
70
|
var propagator = new core_1.W3CTraceContextPropagator();
|
71
71
|
var carrier = {
|
72
72
|
traceparent: null,
|
73
|
-
tracestate: null
|
73
|
+
tracestate: null,
|
74
74
|
};
|
75
75
|
var setter = {
|
76
76
|
set: function (carrier, key, value) {
|
@@ -82,6 +82,6 @@ function currentOpenTelemetryHeaders() {
|
|
82
82
|
propagator.inject(api_1.context.active(), carrier, setter);
|
83
83
|
return {
|
84
84
|
traceparent: carrier.traceparent,
|
85
|
-
tracestate: carrier.tracestate
|
85
|
+
tracestate: carrier.tracestate,
|
86
86
|
};
|
87
87
|
}
|
package/dist/index.d.ts
CHANGED
@@ -21,6 +21,8 @@ import { OpenInferenceSpanKind } from './OpenTelemetry/OpenInference/types';
|
|
21
21
|
import ArvoOrchestrationSubject from './ArvoOrchestrationSubject';
|
22
22
|
import { ArvoOrchestrationSubjectContentSchema, ArvoOchestratorVersionSchema } from './ArvoOrchestrationSubject/schema';
|
23
23
|
import { ArvoOrchestrationSubjectContent, ArvoOchestratorVersion } from './ArvoOrchestrationSubject/type';
|
24
|
+
import ArvoEventHttp from './ArvoEventHttp';
|
25
|
+
import { ArvoEventHttpConfig } from './ArvoEventHttp/types';
|
24
26
|
/**
|
25
27
|
* Collection of Zod schemas for validating various aspects of Arvo events.
|
26
28
|
* @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
|
@@ -87,4 +89,4 @@ declare const ArvoEventSchemas: {
|
|
87
89
|
tracestate: string | null;
|
88
90
|
}>;
|
89
91
|
};
|
90
|
-
export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, InferArvoContract, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContentSchema, ArvoOchestratorVersionSchema, ArvoOrchestrationSubjectContent, ArvoOchestratorVersion, };
|
92
|
+
export { ArvoEventHttpConfig, ArvoEventHttp, ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, InferArvoContract, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContentSchema, ArvoOchestratorVersionSchema, ArvoOrchestrationSubjectContent, ArvoOchestratorVersion, };
|
package/dist/index.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.ArvoOchestratorVersionSchema = exports.ArvoOrchestrationSubjectContentSchema = exports.ArvoOrchestrationSubject = exports.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.ArvoErrorSchema = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.createArvoContractLibrary = exports.ArvoContractLibrary = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchemas = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = void 0;
|
6
|
+
exports.ArvoOchestratorVersionSchema = exports.ArvoOrchestrationSubjectContentSchema = exports.ArvoOrchestrationSubject = exports.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.ArvoErrorSchema = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.createArvoContractLibrary = exports.ArvoContractLibrary = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchemas = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = exports.ArvoEventHttp = void 0;
|
7
7
|
var ArvoEvent_1 = __importDefault(require("./ArvoEvent"));
|
8
8
|
exports.ArvoEvent = ArvoEvent_1.default;
|
9
9
|
var schema_1 = require("./ArvoEvent/schema");
|
@@ -47,6 +47,8 @@ exports.ArvoOrchestrationSubject = ArvoOrchestrationSubject_1.default;
|
|
47
47
|
var schema_3 = require("./ArvoOrchestrationSubject/schema");
|
48
48
|
Object.defineProperty(exports, "ArvoOrchestrationSubjectContentSchema", { enumerable: true, get: function () { return schema_3.ArvoOrchestrationSubjectContentSchema; } });
|
49
49
|
Object.defineProperty(exports, "ArvoOchestratorVersionSchema", { enumerable: true, get: function () { return schema_3.ArvoOchestratorVersionSchema; } });
|
50
|
+
var ArvoEventHttp_1 = __importDefault(require("./ArvoEventHttp"));
|
51
|
+
exports.ArvoEventHttp = ArvoEventHttp_1.default;
|
50
52
|
/**
|
51
53
|
* Collection of Zod schemas for validating various aspects of Arvo events.
|
52
54
|
* @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
|