arvo-core 1.1.15 → 1.1.17

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -64,3 +64,7 @@
64
64
 
65
65
  - Added Arvo Orchestrator Contract primitive
66
66
 
67
+ ## [1.1.16] - 2024-10-21
68
+
69
+ - Added mandatory parent chaining in orchestration events so the process chaining and orchestration chaining can be traced
70
+
@@ -34,8 +34,12 @@ var utils_1 = require("../utils");
34
34
  * });
35
35
  */
36
36
  var createArvoContract = function (contract) {
37
- var createErrorMessage = function (source, type) { return (0, utils_1.cleanString)("\n In contract (uri=".concat(contract.uri, "), the '").concat(source, "' event (type=").concat(type, ") must not start \n with '").concat(typegen_1.ArvoOrchestratorEventTypeGen.__prefix, "' becuase this a reserved pattern \n for Arvo orchestrators.\n ")); };
38
- var validator = function (value) { return value.startsWith(typegen_1.ArvoOrchestratorEventTypeGen.__prefix); };
37
+ var createErrorMessage = function (source, type) {
38
+ return (0, utils_1.cleanString)("\n In contract (uri=".concat(contract.uri, "), the '").concat(source, "' event (type=").concat(type, ") must not start \n with '").concat(typegen_1.ArvoOrchestratorEventTypeGen.__prefix, "' becuase this a reserved pattern \n for Arvo orchestrators.\n "));
39
+ };
40
+ var validator = function (value) {
41
+ return value.startsWith(typegen_1.ArvoOrchestratorEventTypeGen.__prefix);
42
+ };
39
43
  if (validator(contract.accepts.type)) {
40
44
  throw new Error(createErrorMessage('accepts', contract.accepts.type));
41
45
  }
@@ -1,5 +1,6 @@
1
1
  import ArvoEvent from '.';
2
2
  import { ArvoEventData, CloudEventExtension, CreateArvoEvent } from './types';
3
+ import { ExecutionOpenTelemetryConfiguration } from '../types';
3
4
  /**
4
5
  * Creates an ArvoEvent with the provided data and extensions.
5
6
  *
@@ -35,4 +36,4 @@ import { ArvoEventData, CloudEventExtension, CreateArvoEvent } from './types';
35
36
  * { customextension: 'value' },
36
37
  * );
37
38
  */
38
- export declare const createArvoEvent: <TData extends ArvoEventData, TExtension extends CloudEventExtension, TType extends string>(event: CreateArvoEvent<TData, TType>, extensions?: TExtension) => ArvoEvent<TData, TExtension, TType>;
39
+ export declare const createArvoEvent: <TData extends ArvoEventData, TExtension extends CloudEventExtension, TType extends string>(event: CreateArvoEvent<TData, TType>, extensions?: TExtension, opentelemetry?: ExecutionOpenTelemetryConfiguration) => ArvoEvent<TData, TExtension, TType>;
@@ -45,8 +45,11 @@ var uuid_1 = require("uuid");
45
45
  * { customextension: 'value' },
46
46
  * );
47
47
  */
48
- var createArvoEvent = function (event, extensions) {
49
- var span = OpenTelemetry_1.ArvoCoreTracer.startSpan("createArvoEvent<".concat(event.type, ">"), {});
48
+ var createArvoEvent = function (event, extensions, opentelemetry) {
49
+ if (opentelemetry === void 0) { opentelemetry = {
50
+ tracer: OpenTelemetry_1.ArvoCoreTracer,
51
+ }; }
52
+ var span = opentelemetry.tracer.startSpan("createArvoEvent<".concat(event.type, ">"), {});
50
53
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
51
54
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
52
55
  span.setStatus({ code: api_1.SpanStatusCode.OK });
@@ -1,6 +1,7 @@
1
1
  import ArvoContract from '../ArvoContract';
2
2
  import { z } from 'zod';
3
3
  import { CreateArvoEvent } from '../ArvoEvent/types';
4
+ import { ExecutionOpenTelemetryConfiguration } from '../types';
4
5
  /**
5
6
  * A factory class for creating contractual ArvoEvents based on a given ArvoContract.
6
7
  *
@@ -26,7 +27,7 @@ export default class ArvoEventFactory<TUri extends string = string, TType extend
26
27
  * @returns The created ArvoEvent as per the accept record of the contract.
27
28
  * @throws If the event data fails validation against the contract.
28
29
  */
29
- accepts<TExtension extends Record<string, any>>(event: Omit<CreateArvoEvent<z.input<TAcceptSchema>, TType>, 'type' | 'datacontenttype' | 'dataschema'>, extensions?: TExtension): import("..").ArvoEvent<z.TypeOf<TAcceptSchema>, TExtension, TType>;
30
+ accepts<TExtension extends Record<string, any>>(event: Omit<CreateArvoEvent<z.input<TAcceptSchema>, TType>, 'type' | 'datacontenttype' | 'dataschema'>, extensions?: TExtension, opentelemetry?: ExecutionOpenTelemetryConfiguration): import("..").ArvoEvent<z.TypeOf<TAcceptSchema>, TExtension, TType>;
30
31
  /**
31
32
  * Creates an ArvoEvent as per one of the emits record in the contract.
32
33
  *
@@ -37,7 +38,7 @@ export default class ArvoEventFactory<TUri extends string = string, TType extend
37
38
  * @returns The created ArvoEvent as per one of the emits records of the contract.
38
39
  * @throws If the event data fails validation against the contract.
39
40
  */
40
- emits<U extends keyof TEmits & string, TExtension extends Record<string, any>>(event: Omit<CreateArvoEvent<z.input<TEmits[U]>, U>, 'datacontenttype' | 'dataschema'>, extensions?: TExtension): import("..").ArvoEvent<z.TypeOf<TEmits[U]>, TExtension, U>;
41
+ emits<U extends keyof TEmits & string, TExtension extends Record<string, any>>(event: Omit<CreateArvoEvent<z.input<TEmits[U]>, U>, 'datacontenttype' | 'dataschema'>, extensions?: TExtension, opentelemetry?: ExecutionOpenTelemetryConfiguration): import("..").ArvoEvent<z.TypeOf<TEmits[U]>, TExtension, U>;
41
42
  /**
42
43
  * Creates a system error ArvoEvent.
43
44
  *
@@ -48,7 +49,7 @@ export default class ArvoEventFactory<TUri extends string = string, TType extend
48
49
  */
49
50
  systemError<TExtension extends Record<string, any>>(event: Omit<CreateArvoEvent<any, any>, 'data' | 'type' | 'datacontenttype' | 'dataschema'> & {
50
51
  error: Error;
51
- }, extensions?: TExtension): import("..").ArvoEvent<{
52
+ }, extensions?: TExtension, opentelemetry?: ExecutionOpenTelemetryConfiguration): import("..").ArvoEvent<{
52
53
  errorMessage: string;
53
54
  errorName: string;
54
55
  errorStack: string | null;
@@ -52,9 +52,12 @@ var ArvoEventFactory = /** @class */ (function () {
52
52
  * @returns The created ArvoEvent as per the accept record of the contract.
53
53
  * @throws If the event data fails validation against the contract.
54
54
  */
55
- ArvoEventFactory.prototype.accepts = function (event, extensions) {
55
+ ArvoEventFactory.prototype.accepts = function (event, extensions, opentelemetry) {
56
56
  var _this = this;
57
- var span = OpenTelemetry_1.ArvoCoreTracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.accepts<").concat(this.contract.accepts.type, ">.create"));
57
+ if (opentelemetry === void 0) { opentelemetry = {
58
+ tracer: OpenTelemetry_1.ArvoCoreTracer,
59
+ }; }
60
+ var span = opentelemetry.tracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.accepts<").concat(this.contract.accepts.type, ">.create"));
58
61
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
59
62
  var _a, _b, _c, _d;
60
63
  span.setStatus({ code: api_1.SpanStatusCode.OK });
@@ -64,7 +67,7 @@ var ArvoEventFactory = /** @class */ (function () {
64
67
  if (!validationResult.success) {
65
68
  throw new Error("Accept Event data validation failed: ".concat(validationResult.error.message));
66
69
  }
67
- return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { traceparent: (_b = (_a = event.traceparent) !== null && _a !== void 0 ? _a : otelHeaders.traceparent) !== null && _b !== void 0 ? _b : undefined, tracestate: (_d = (_c = event.tracestate) !== null && _c !== void 0 ? _c : otelHeaders.tracestate) !== null && _d !== void 0 ? _d : undefined, type: _this.contract.accepts.type, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions);
70
+ return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { traceparent: (_b = (_a = event.traceparent) !== null && _a !== void 0 ? _a : otelHeaders.traceparent) !== null && _b !== void 0 ? _b : undefined, tracestate: (_d = (_c = event.tracestate) !== null && _c !== void 0 ? _c : otelHeaders.tracestate) !== null && _d !== void 0 ? _d : undefined, type: _this.contract.accepts.type, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions, opentelemetry);
68
71
  }
69
72
  catch (error) {
70
73
  (0, OpenTelemetry_1.exceptionToSpan)(error);
@@ -89,9 +92,12 @@ var ArvoEventFactory = /** @class */ (function () {
89
92
  * @returns The created ArvoEvent as per one of the emits records of the contract.
90
93
  * @throws If the event data fails validation against the contract.
91
94
  */
92
- ArvoEventFactory.prototype.emits = function (event, extensions) {
95
+ ArvoEventFactory.prototype.emits = function (event, extensions, opentelemetry) {
93
96
  var _this = this;
94
- var span = OpenTelemetry_1.ArvoCoreTracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.emits<").concat(event.type, ">.create"));
97
+ if (opentelemetry === void 0) { opentelemetry = {
98
+ tracer: OpenTelemetry_1.ArvoCoreTracer,
99
+ }; }
100
+ var span = opentelemetry.tracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.emits<").concat(event.type, ">.create"));
95
101
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
96
102
  var _a, _b, _c, _d;
97
103
  span.setStatus({ code: api_1.SpanStatusCode.OK });
@@ -101,7 +107,7 @@ var ArvoEventFactory = /** @class */ (function () {
101
107
  if (!validationResult.success) {
102
108
  throw new Error("Emit Event data validation failed: ".concat(validationResult.error.message));
103
109
  }
104
- return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { traceparent: (_b = (_a = event.traceparent) !== null && _a !== void 0 ? _a : otelHeaders.traceparent) !== null && _b !== void 0 ? _b : undefined, tracestate: (_d = (_c = event.tracestate) !== null && _c !== void 0 ? _c : otelHeaders.tracestate) !== null && _d !== void 0 ? _d : undefined, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions);
110
+ return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { traceparent: (_b = (_a = event.traceparent) !== null && _a !== void 0 ? _a : otelHeaders.traceparent) !== null && _b !== void 0 ? _b : undefined, tracestate: (_d = (_c = event.tracestate) !== null && _c !== void 0 ? _c : otelHeaders.tracestate) !== null && _d !== void 0 ? _d : undefined, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions, opentelemetry);
105
111
  }
106
112
  catch (error) {
107
113
  (0, OpenTelemetry_1.exceptionToSpan)(error);
@@ -124,9 +130,12 @@ var ArvoEventFactory = /** @class */ (function () {
124
130
  * @param [extensions] - Optional extensions to add to the event.
125
131
  * @returns The created system error ArvoEvent.
126
132
  */
127
- ArvoEventFactory.prototype.systemError = function (event, extensions) {
133
+ ArvoEventFactory.prototype.systemError = function (event, extensions, opentelemetry) {
128
134
  var _this = this;
129
- var span = OpenTelemetry_1.ArvoCoreTracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.systemError<sys.").concat(this.contract.accepts.type, ".error>.create"));
135
+ if (opentelemetry === void 0) { opentelemetry = {
136
+ tracer: OpenTelemetry_1.ArvoCoreTracer,
137
+ }; }
138
+ var span = opentelemetry.tracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.systemError<sys.").concat(this.contract.accepts.type, ".error>.create"));
130
139
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
131
140
  var _a, _b, _c, _d, _e;
132
141
  span.setStatus({ code: api_1.SpanStatusCode.OK });
@@ -137,7 +146,7 @@ var ArvoEventFactory = /** @class */ (function () {
137
146
  errorName: error.name,
138
147
  errorMessage: error.message,
139
148
  errorStack: (_e = error.stack) !== null && _e !== void 0 ? _e : null,
140
- }, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri }), extensions);
149
+ }, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri }), extensions, opentelemetry);
141
150
  }
142
151
  catch (error) {
143
152
  (0, OpenTelemetry_1.exceptionToSpan)(error);
@@ -1,6 +1,6 @@
1
- import { z } from "zod";
2
- import { ICreateArvoOrchestratorContract } from "./types";
3
- import ArvoOrchestratorContract from ".";
1
+ import { z } from 'zod';
2
+ import { ICreateArvoOrchestratorContract } from './types';
3
+ import ArvoOrchestratorContract from '.';
4
4
  /**
5
5
  * Creates an ArvoOrchestratorContract with specified parameters.
6
6
  *
@@ -10,22 +10,58 @@ import ArvoOrchestratorContract from ".";
10
10
  *
11
11
  * Key features:
12
12
  * 1. Initialization: Defines the structure and validation for the initial event that starts the orchestration.
13
+ * The init schema is automatically intersected with OrchestrationInitEventBaseSchema.
13
14
  * 2. Completion: Specifies the event type and data emitted when the orchestration process concludes.
14
15
  * 3. Type Safety: Utilizes TypeScript generics to ensure type consistency across the contract definition.
15
16
  * 4. Runtime Validation: Employs Zod schemas for robust runtime type checking and data validation.
16
17
  *
18
+ * Base Schema:
19
+ * The OrchestrationInitEventBaseSchema is automatically intersected with the user-provided init schema.
20
+ * This base schema includes essential fields for orchestration, such as:
21
+ * - parentSubject$$: Identifies the subject of the parent process or event in the ArvoEvent system.
22
+ *
17
23
  * This contract serves as a crucial component in maintaining consistency and type safety
18
24
  * throughout the orchestration process, from initiation to completion.
19
25
  *
20
26
  * @param param - The configuration object for creating the contract.
21
27
  * @param param.uri - The URI for the contract.
22
- * @param param.name - The name of the contract (must be alphanumeric).
28
+ * @param param.name - The name of the contract (must be lowercase alphanumeric with dots).
23
29
  * @param param.schema - The schema object containing init and complete Zod schemas.
24
- * @param param.schema.init - The Zod schema for initialization.
30
+ * @param param.schema.init - The Zod schema for initialization (will be intersected with OrchestrationInitEventBaseSchema).
25
31
  * @param param.schema.complete - The Zod schema for completion.
26
32
  *
27
- * @throws {Error} Throws an error if the name is not alphanumeric.
33
+ * @throws {Error} Throws an error if the name is not lowercase alphanumeric with dots.
28
34
  *
29
35
  * @returns Returns a new ArvoOrchestratorContract instance with the specified parameters.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * import { createArvoOrchestratorContract } from 'arvo-core'
40
+ * import { z } from 'zod'
41
+ *
42
+ * const contract = createArvoOrchestratorContract({
43
+ * uri: '#/example/contract',
44
+ * name: 'rag.orchestrator',
45
+ * schema: {
46
+ * init: z.object({
47
+ * request: z.string(),
48
+ * vectorStore: z.string(),
49
+ * llm: z.string()
50
+ * }),
51
+ * complete: z.object({
52
+ * response: z.string()
53
+ * })
54
+ * }
55
+ * })
56
+ * ```
57
+ *
58
+ * In this example, the actual init schema will be an intersection of the provided schema
59
+ * and the OrchestrationInitEventBaseSchema, ensuring all necessary fields are included.
30
60
  */
31
- export declare const createArvoOrchestratorContract: <TUri extends string, TName extends string, TInit extends z.ZodTypeAny, TComplete extends z.ZodTypeAny>(param: ICreateArvoOrchestratorContract<TUri, TName, TInit, TComplete>) => ArvoOrchestratorContract<TUri, `arvo.orc.${TName}`, TInit, `arvo.orc.${TName}.done`, TComplete>;
61
+ export declare const createArvoOrchestratorContract: <TUri extends string, TName extends string, TInit extends z.ZodTypeAny, TComplete extends z.ZodTypeAny>(param: ICreateArvoOrchestratorContract<TUri, TName, TInit, TComplete>) => ArvoOrchestratorContract<TUri, `arvo.orc.${TName}`, z.ZodIntersection<z.ZodObject<{
62
+ parentSubject$$: z.ZodNullable<z.ZodString>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ parentSubject$$: string | null;
65
+ }, {
66
+ parentSubject$$: string | null;
67
+ }>, TInit>, `arvo.orc.${TName}.done`, TComplete>;
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createArvoOrchestratorContract = void 0;
7
+ var zod_1 = require("zod");
7
8
  var _1 = __importDefault(require("."));
8
9
  var typegen_1 = require("./typegen");
10
+ var schema_1 = require("./schema");
9
11
  /**
10
12
  * Validates if a string contains only uppercase or lowercase alphanumeric characters.
11
13
  *
@@ -32,23 +34,53 @@ function isLowerAlphanumeric(input) {
32
34
  *
33
35
  * Key features:
34
36
  * 1. Initialization: Defines the structure and validation for the initial event that starts the orchestration.
37
+ * The init schema is automatically intersected with OrchestrationInitEventBaseSchema.
35
38
  * 2. Completion: Specifies the event type and data emitted when the orchestration process concludes.
36
39
  * 3. Type Safety: Utilizes TypeScript generics to ensure type consistency across the contract definition.
37
40
  * 4. Runtime Validation: Employs Zod schemas for robust runtime type checking and data validation.
38
41
  *
42
+ * Base Schema:
43
+ * The OrchestrationInitEventBaseSchema is automatically intersected with the user-provided init schema.
44
+ * This base schema includes essential fields for orchestration, such as:
45
+ * - parentSubject$$: Identifies the subject of the parent process or event in the ArvoEvent system.
46
+ *
39
47
  * This contract serves as a crucial component in maintaining consistency and type safety
40
48
  * throughout the orchestration process, from initiation to completion.
41
49
  *
42
50
  * @param param - The configuration object for creating the contract.
43
51
  * @param param.uri - The URI for the contract.
44
- * @param param.name - The name of the contract (must be alphanumeric).
52
+ * @param param.name - The name of the contract (must be lowercase alphanumeric with dots).
45
53
  * @param param.schema - The schema object containing init and complete Zod schemas.
46
- * @param param.schema.init - The Zod schema for initialization.
54
+ * @param param.schema.init - The Zod schema for initialization (will be intersected with OrchestrationInitEventBaseSchema).
47
55
  * @param param.schema.complete - The Zod schema for completion.
48
56
  *
49
- * @throws {Error} Throws an error if the name is not alphanumeric.
57
+ * @throws {Error} Throws an error if the name is not lowercase alphanumeric with dots.
50
58
  *
51
59
  * @returns Returns a new ArvoOrchestratorContract instance with the specified parameters.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * import { createArvoOrchestratorContract } from 'arvo-core'
64
+ * import { z } from 'zod'
65
+ *
66
+ * const contract = createArvoOrchestratorContract({
67
+ * uri: '#/example/contract',
68
+ * name: 'rag.orchestrator',
69
+ * schema: {
70
+ * init: z.object({
71
+ * request: z.string(),
72
+ * vectorStore: z.string(),
73
+ * llm: z.string()
74
+ * }),
75
+ * complete: z.object({
76
+ * response: z.string()
77
+ * })
78
+ * }
79
+ * })
80
+ * ```
81
+ *
82
+ * In this example, the actual init schema will be an intersection of the provided schema
83
+ * and the OrchestrationInitEventBaseSchema, ensuring all necessary fields are included.
52
84
  */
53
85
  var createArvoOrchestratorContract = function (param) {
54
86
  if (!isLowerAlphanumeric(param.name)) {
@@ -58,12 +90,12 @@ var createArvoOrchestratorContract = function (param) {
58
90
  uri: param.uri,
59
91
  init: {
60
92
  type: typegen_1.ArvoOrchestratorEventTypeGen.init(param.name),
61
- schema: param.schema.init,
93
+ schema: zod_1.z.intersection(schema_1.OrchestrationInitEventBaseSchema, param.schema.init),
62
94
  },
63
95
  complete: {
64
96
  type: typegen_1.ArvoOrchestratorEventTypeGen.complete(param.name),
65
97
  schema: param.schema.complete,
66
- }
98
+ },
67
99
  });
68
100
  };
69
101
  exports.createArvoOrchestratorContract = createArvoOrchestratorContract;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Defines the base schema for orchestrator acceptance in the context of ArvoEvents.
4
+ * This schema is used to validate and type-check the minimal required fields
5
+ * for an orchestrator to accept a task or event.
6
+ */
7
+ export declare const OrchestrationInitEventBaseSchema: z.ZodObject<{
8
+ parentSubject$$: z.ZodNullable<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ parentSubject$$: string | null;
11
+ }, {
12
+ parentSubject$$: string | null;
13
+ }>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrchestrationInitEventBaseSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ var utils_1 = require("../utils");
6
+ /**
7
+ * Defines the base schema for orchestrator acceptance in the context of ArvoEvents.
8
+ * This schema is used to validate and type-check the minimal required fields
9
+ * for an orchestrator to accept a task or event.
10
+ */
11
+ exports.OrchestrationInitEventBaseSchema = zod_1.z.object({
12
+ parentSubject$$: zod_1.z
13
+ .string()
14
+ .min(1, 'The parent subject must not be an empty string')
15
+ .nullable()
16
+ .describe((0, utils_1.cleanString)("\n Identifies the subject of the parent process or event in the ArvoEvent system.\n \n Purpose:\n 1. Enables the orchestrator to return its final output to the initiating process or orchestrator.\n 2. Maintains the event chain and process hierarchy in a distributed system.\n 3. Facilitates proper event routing and traceability.\n \n Usage:\n - For non-root processes: Set to the subject of the parent process/orchestrator.\n - For root processes/orchestrations: Must be set to null.\n \n This field aligns with the ArvoEvent 'subject' field, which is a URI identifying the event's subject.\n It plays a crucial role in distributed tracing, debugging, and maintaining system coherence.\n \n Example:\n - Parent process subject: \"process/parent-id-123\"\n - Child process parentSubject$$: \"process/parent-id-123\"\n \n Note: Ensure this value is a valid URI as per ArvoEvent specifications.\n ")),
17
+ });
@@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArvoOrchestratorEventTypeGen = void 0;
4
4
  exports.ArvoOrchestratorEventTypeGen = {
5
5
  __prefix: "arvo.orc",
6
- init: function (name) { return "".concat(exports.ArvoOrchestratorEventTypeGen.__prefix, ".").concat(name); },
7
- complete: function (name) { return "".concat(exports.ArvoOrchestratorEventTypeGen.init(name), ".done"); },
8
- systemError: function (name) { return "sys.".concat(exports.ArvoOrchestratorEventTypeGen.init(name), ".error"); }
6
+ init: function (name) {
7
+ return "".concat(exports.ArvoOrchestratorEventTypeGen.__prefix, ".").concat(name);
8
+ },
9
+ complete: function (name) {
10
+ return "".concat(exports.ArvoOrchestratorEventTypeGen.init(name), ".done");
11
+ },
12
+ systemError: function (name) {
13
+ return "sys.".concat(exports.ArvoOrchestratorEventTypeGen.init(name), ".error");
14
+ },
9
15
  };
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ import { createArvoOrchestratorContract } from './ArvoOrchestratorContract/helpe
28
28
  import ArvoOrchestratorContract from './ArvoOrchestratorContract';
29
29
  import { ICreateArvoOrchestratorContract, IArvoOrchestratorContract } from './ArvoOrchestratorContract/types';
30
30
  import { ArvoOrchestratorEventTypeGen } from './ArvoOrchestratorContract/typegen';
31
+ import { ExecutionOpenTelemetryConfiguration } from './types';
31
32
  /**
32
33
  * Collection of Zod schemas for validating various aspects of Arvo events.
33
34
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
@@ -35,6 +36,7 @@ import { ArvoOrchestratorEventTypeGen } from './ArvoOrchestratorContract/typegen
35
36
  * @property {z.ZodRecord} ArvoDataSchema - Schema for Arvo event data payload.
36
37
  * @property {z.ZodObject} ArvoExtensionSchema - Schema for Arvo-specific CloudEvent extensions.
37
38
  * @property {z.ZodObject} OpenTelemetryExtensionSchema - Schema for OpenTelemetry extensions.
39
+ * @property {z.ZodObject} OrchestrationInitEventBaseSchema - The base schema for the orchestrator init events.
38
40
  */
39
41
  declare const ArvoEventSchemas: {
40
42
  CloudEventContextSchema: import("zod").ZodObject<{
@@ -93,5 +95,12 @@ declare const ArvoEventSchemas: {
93
95
  traceparent: string | null;
94
96
  tracestate: string | null;
95
97
  }>;
98
+ OrchestrationInitEventBaseSchema: import("zod").ZodObject<{
99
+ parentSubject$$: import("zod").ZodNullable<import("zod").ZodString>;
100
+ }, "strip", import("zod").ZodTypeAny, {
101
+ parentSubject$$: string | null;
102
+ }, {
103
+ parentSubject$$: string | null;
104
+ }>;
96
105
  };
97
- export { ArvoEventHttpConfig, ArvoEventHttp, ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContentSchema, ArvoOrchestratorVersionSchema, ArvoOrchestrationSubjectContent, ArvoOrchestratorVersion, InferArvoEvent, InferArvoContract, InferArvoContractType, createArvoOrchestratorContract, ArvoOrchestratorContract, ICreateArvoOrchestratorContract, IArvoOrchestratorContract, InferArvoOrchestratorContract, ArvoOrchestratorEventTypeGen };
106
+ export { ArvoEventHttpConfig, ArvoEventHttp, ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContentSchema, ArvoOrchestratorVersionSchema, ArvoOrchestrationSubjectContent, ArvoOrchestratorVersion, InferArvoEvent, InferArvoContract, InferArvoContractType, createArvoOrchestratorContract, ArvoOrchestratorContract, ICreateArvoOrchestratorContract, IArvoOrchestratorContract, InferArvoOrchestratorContract, ArvoOrchestratorEventTypeGen, ExecutionOpenTelemetryConfiguration, };
package/dist/index.js CHANGED
@@ -55,6 +55,7 @@ var ArvoOrchestratorContract_1 = __importDefault(require("./ArvoOrchestratorCont
55
55
  exports.ArvoOrchestratorContract = ArvoOrchestratorContract_1.default;
56
56
  var typegen_1 = require("./ArvoOrchestratorContract/typegen");
57
57
  Object.defineProperty(exports, "ArvoOrchestratorEventTypeGen", { enumerable: true, get: function () { return typegen_1.ArvoOrchestratorEventTypeGen; } });
58
+ var schema_4 = require("./ArvoOrchestratorContract/schema");
58
59
  /**
59
60
  * Collection of Zod schemas for validating various aspects of Arvo events.
60
61
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
@@ -62,6 +63,7 @@ Object.defineProperty(exports, "ArvoOrchestratorEventTypeGen", { enumerable: tru
62
63
  * @property {z.ZodRecord} ArvoDataSchema - Schema for Arvo event data payload.
63
64
  * @property {z.ZodObject} ArvoExtensionSchema - Schema for Arvo-specific CloudEvent extensions.
64
65
  * @property {z.ZodObject} OpenTelemetryExtensionSchema - Schema for OpenTelemetry extensions.
66
+ * @property {z.ZodObject} OrchestrationInitEventBaseSchema - The base schema for the orchestrator init events.
65
67
  */
66
68
  var ArvoEventSchemas = {
67
69
  CloudEventContextSchema: schema_1.CloudEventContextSchema,
@@ -69,5 +71,6 @@ var ArvoEventSchemas = {
69
71
  ArvoDataSchema: schema_1.ArvoDataSchema,
70
72
  ArvoExtensionSchema: schema_1.ArvoExtensionSchema,
71
73
  OpenTelemetryExtensionSchema: schema_1.OpenTelemetryExtensionSchema,
74
+ OrchestrationInitEventBaseSchema: schema_4.OrchestrationInitEventBaseSchema,
72
75
  };
73
76
  exports.ArvoEventSchemas = ArvoEventSchemas;
package/dist/types.d.ts CHANGED
@@ -3,6 +3,20 @@ import ArvoContract from './ArvoContract';
3
3
  import ArvoEvent from './ArvoEvent';
4
4
  import { ArvoExtension, OpenTelemetryExtension } from './ArvoEvent/types';
5
5
  import ArvoOrchestratorContract from './ArvoOrchestratorContract';
6
+ import { Tracer } from '@opentelemetry/api';
7
+ /**
8
+ * Configuration options for OpenTelemetry integration in execution context.
9
+ *
10
+ * This type defines how tracing should be configured and inherited within
11
+ * the execution pipeline.
12
+ */
13
+ export type ExecutionOpenTelemetryConfiguration = {
14
+ /**
15
+ * Optional OpenTelemetry tracer instance to use for creating spans.
16
+ * If not provided, a default tracer may be used depending on the implementation.
17
+ */
18
+ tracer: Tracer;
19
+ };
6
20
  /**
7
21
  * A type utility that infers the structure of an ArvoEvent.
8
22
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "This core package contains all the core classes and components of the Arvo Event Driven System",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {