arvo-core 1.2.3 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/ArvoContract/helpers.d.ts +119 -20
  3. package/dist/ArvoContract/helpers.js +150 -32
  4. package/dist/ArvoContract/index.d.ts +32 -26
  5. package/dist/ArvoContract/index.js +69 -60
  6. package/dist/ArvoContract/types.d.ts +49 -35
  7. package/dist/ArvoEvent/schema.d.ts +2 -2
  8. package/dist/ArvoEventFactory/helpers.d.ts +39 -9
  9. package/dist/ArvoEventFactory/helpers.js +50 -8
  10. package/dist/ArvoEventFactory/index.d.ts +60 -33
  11. package/dist/ArvoEventFactory/index.js +62 -36
  12. package/dist/ArvoOrchestrationSubject/index.d.ts +5 -4
  13. package/dist/ArvoOrchestrationSubject/index.js +2 -2
  14. package/dist/ArvoOrchestrationSubject/schema.d.ts +1 -2
  15. package/dist/ArvoOrchestrationSubject/schema.js +4 -11
  16. package/dist/ArvoOrchestrationSubject/type.d.ts +2 -12
  17. package/dist/ArvoOrchestratorContract/index.d.ts +62 -56
  18. package/dist/ArvoOrchestratorContract/index.js +99 -93
  19. package/dist/ArvoOrchestratorContract/types.d.ts +64 -71
  20. package/dist/index.d.ts +14 -18
  21. package/dist/index.js +12 -14
  22. package/dist/schema.d.ts +1 -0
  23. package/dist/schema.js +6 -1
  24. package/dist/types.d.ts +107 -81
  25. package/dist/utils.d.ts +21 -0
  26. package/dist/utils.js +33 -0
  27. package/package.json +1 -1
  28. package/dist/ArvoContractLibrary/helpers.d.ts +0 -10
  29. package/dist/ArvoContractLibrary/helpers.js +0 -22
  30. package/dist/ArvoContractLibrary/index.d.ts +0 -61
  31. package/dist/ArvoContractLibrary/index.js +0 -87
  32. package/dist/ArvoOrchestratorContract/helpers.d.ts +0 -67
  33. package/dist/ArvoOrchestratorContract/helpers.js +0 -101
@@ -1,107 +1,113 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
2
  Object.defineProperty(exports, "__esModule", { value: true });
21
- var ArvoContract_1 = __importDefault(require("../ArvoContract"));
3
+ exports.createArvoOrchestratorContract = void 0;
4
+ var typegen_1 = require("./typegen");
5
+ var schema_1 = require("./schema");
6
+ var helpers_1 = require("../ArvoContract/helpers");
7
+ /**
8
+ * Validates if a string contains only uppercase or lowercase alphanumeric characters.
9
+ *
10
+ * This function checks if the input string consists solely of:
11
+ * - Lowercase letters (a-z)
12
+ * - Numbers (0-9)
13
+ * - Dot (.)
14
+ *
15
+ * It does not allow any special characters, spaces, or other non-alphanumeric characters.
16
+ *
17
+ * @param input - The string to be validated.
18
+ * @returns True if the string contains only alphanumeric characters, false otherwise.
19
+ */
20
+ function isLowerAlphanumeric(input) {
21
+ var alphanumericRegex = /^[a-z0-9.]+$/;
22
+ return alphanumericRegex.test(input);
23
+ }
22
24
  /**
23
- * Defines the contract for the Arvo Orchestrator, specifying accepted events and emitted events.
25
+ * Creates an ArvoOrchestratorContract with specified parameters.
24
26
  *
25
- * The ArvoOrchestratorContract is a specialized contract class designed to manage the lifecycle
26
- * of orchestration processes within the Arvo framework. It extends the base ArvoContract class
27
- * to provide specific functionality for orchestration scenarios.
27
+ * The ArvoOrchestratorContract is a specialized contract designed to manage the lifecycle
28
+ * of orchestration processes within the Arvo framework. It creates a contract with an init event
29
+ * type and a corresponding complete event type.
28
30
  *
29
31
  * Key features:
30
- * 1. Initialization: Defines the structure and validation for the initial event that starts the orchestration.
31
- * 2. Completion: Specifies the event type and data emitted when the orchestration process concludes.
32
- * 3. Type Safety: Utilizes TypeScript generics to ensure type consistency across the contract definition.
33
- * 4. Runtime Validation: Employs Zod schemas for robust runtime type checking and data validation.
32
+ * 1. Type Validation: Ensures the type parameter follows lowercase alphanumeric with dots format
33
+ * 2. Event Type Generation: Automatically generates init and complete event types based on the provided type
34
+ * 3. Schema Merging: Merges provided init schemas with the OrchestrationInitEventBaseSchema
35
+ * 4. Version Support: Handles multiple versions of the contract with their respective schemas
34
36
  *
35
- * This contract serves as a crucial component in maintaining consistency and type safety
36
- * throughout the orchestration process, from initiation to completion.
37
+ * @template TUri - The URI type for the contract
38
+ * @template TType - The type identifier for the contract events
39
+ * @template TVersions - Record of versions with their corresponding init and complete schemas
40
+ *
41
+ * @param param - Configuration object for the orchestrator contract
42
+ * @param param.uri - The URI that uniquely identifies this contract
43
+ * @param param.type - The base type identifier (must be lowercase alphanumeric with dots)
44
+ * @param param.versions - Record of version configurations
45
+ * @param param.versions[version].init - Zod schema for initialization event (merged with OrchestrationInitEventBaseSchema)
46
+ * @param param.versions[version].complete - Zod schema for completion event
47
+ *
48
+ * @throws {Error} If the type parameter contains invalid characters (must be lowercase alphanumeric with dots)
49
+ *
50
+ * @returns An ArvoOrchestratorContract instance configured with the specified parameters
37
51
  *
38
52
  * @example
39
53
  * ```typescript
40
- * import { createArvoOrchestratorContract } from 'arvo-core'
41
- * import { z } from 'zod'
42
- *
43
54
  * const contract = createArvoOrchestratorContract({
44
- * uri: '#/example/contract',
45
- * name: 'rag',
46
- * schema: {
47
- * init: z.object({
48
- * request: z.string()
49
- * vectorStore: z.string(),
50
- * llm: z.string()
51
- * }),
52
- * complete: z.object({
53
- * response: z.string()
54
- * })
55
- * }
56
- * })
55
+ * uri: '#/orchestrators/data/processor',
56
+ * type: 'data.processor',
57
+ * versions: {
58
+ * '1.0.0': {
59
+ * init: z.object({
60
+ * data: z.string(),
61
+ * options: z.object({
62
+ * format: z.string()
63
+ * })
64
+ * }),
65
+ * complete: z.object({
66
+ * processedData: z.string(),
67
+ * metadata: z.record(z.string())
68
+ * })
69
+ * },
70
+ * '1.1.0': {
71
+ * init: z.object({
72
+ * data: z.string(),
73
+ * options: z.object({
74
+ * format: z.string(),
75
+ * compression: z.boolean().optional()
76
+ * })
77
+ * }),
78
+ * complete: z.object({
79
+ * processedData: z.string(),
80
+ * metadata: z.record(z.string()),
81
+ * performance: z.object({
82
+ * duration: z.number(),
83
+ * bytesProcessed: z.number()
84
+ * })
85
+ * })
86
+ * }
87
+ * }
88
+ * });
57
89
  * ```
58
90
  */
59
- var ArvoOrchestratorContract = /** @class */ (function (_super) {
60
- __extends(ArvoOrchestratorContract, _super);
61
- /**
62
- * Constructs a new ArvoOrchestratorContract instance.
63
- *
64
- * @param param - The configuration object for the contract.
65
- */
66
- function ArvoOrchestratorContract(param) {
67
- var _a;
68
- return _super.call(this, {
69
- uri: param.uri,
70
- accepts: param.init,
71
- // @ts-ignore
72
- emits: (_a = {},
73
- _a[param.complete.type] = param.complete.schema,
74
- _a),
75
- }) || this;
91
+ var createArvoOrchestratorContract = function (param) {
92
+ if (!isLowerAlphanumeric(param.type)) {
93
+ throw new Error("Invalid 'type' = '".concat(param.type, "'. The 'type' must only contain alphanumeric characters. e.g. test.orchestrator"));
76
94
  }
77
- Object.defineProperty(ArvoOrchestratorContract.prototype, "init", {
78
- /**
79
- * Gets the initialization event configuration.
80
- *
81
- * @returns An object containing the type and schema for the initialization event.
82
- */
83
- get: function () {
84
- return this.accepts;
85
- },
86
- enumerable: false,
87
- configurable: true
88
- });
89
- Object.defineProperty(ArvoOrchestratorContract.prototype, "complete", {
90
- /**
91
- * Gets the completion event configuration.
92
- *
93
- * @returns An object containing the type and schema for the completion event.
94
- */
95
- get: function () {
96
- var _a = Object.entries(this.emits)[0], type = _a[0], schema = _a[1];
97
- return {
98
- type: type,
99
- schema: schema,
100
- };
101
- },
102
- enumerable: false,
103
- configurable: true
104
- });
105
- return ArvoOrchestratorContract;
106
- }(ArvoContract_1.default));
107
- exports.default = ArvoOrchestratorContract;
95
+ return (0, helpers_1.createArvoContract)({
96
+ uri: param.uri,
97
+ type: typegen_1.ArvoOrchestratorEventTypeGen.init(param.type),
98
+ versions: Object.fromEntries(Object.entries(param.versions).map(function (_a) {
99
+ var _b;
100
+ var version = _a[0], contract = _a[1];
101
+ return [
102
+ version,
103
+ {
104
+ accepts: schema_1.OrchestrationInitEventBaseSchema.merge(contract.init),
105
+ emits: (_b = {},
106
+ _b[typegen_1.ArvoOrchestratorEventTypeGen.complete(param.type)] = contract.complete,
107
+ _b),
108
+ },
109
+ ];
110
+ })),
111
+ }, true);
112
+ };
113
+ exports.createArvoOrchestratorContract = createArvoOrchestratorContract;
@@ -1,85 +1,78 @@
1
1
  import { z } from 'zod';
2
+ import { ArvoSemanticVersion } from '../types';
3
+ import ArvoContract from '../ArvoContract';
4
+ import { ArvoOrchestratorEventTypeGen } from './typegen';
5
+ import { OrchestrationInitEventBaseSchema } from './schema';
2
6
  /**
3
- * Represents the configuration interface for an Arvo Orchestrator Contract.
7
+ * Represents an Arvo Orchestrator Contract type that extends the base ArvoContract.
8
+ * This type specifically handles orchestration flows with initialization and completion events.
4
9
  *
5
- * This interface defines the structure of the configuration object used to initialize
6
- * an ArvoOrchestratorContract. It specifies the types and schemas for both the
7
- * initialization event and the completion event of the orchestration process.
10
+ * @template TUri - The URI type that uniquely identifies the contract
11
+ * @template TType - The base event type for the orchestrator
12
+ * @template TVersions - Record of versioned schemas for init and complete events
8
13
  *
9
- * @template TUri - The type for the URI string that uniquely identifies the contract.
10
- * @template TInitType - The literal type for the initialization event type.
11
- * @template TInit - The Zod schema type for validating the initialization event data.
12
- * @template TCompleteType - The literal type for the completion event type.
13
- * @template TComplete - The Zod schema type for validating the completion event data.
14
+ * @example
15
+ * ```typescript
16
+ * type MyOrchestrator = ArvoOrchestratorContract<
17
+ * '/orchestrators/payment-flow',
18
+ * 'payment.process',
19
+ * {
20
+ * '1.0.0': {
21
+ * init: z.object({ amount: z.number() }),
22
+ * complete: z.object({ transactionId: z.string() })
23
+ * }
24
+ * }
25
+ * >;
26
+ * ```
27
+ *
28
+ * @remarks
29
+ * - The contract automatically generates appropriate event types for init and complete events
30
+ * - Each version must specify both init and complete schemas
31
+ * - Event types are generated using the ArvoOrchestratorEventTypeGen utility
14
32
  */
15
- export interface IArvoOrchestratorContract<TUri extends string, TInitType extends string, TInit extends z.ZodTypeAny, TCompleteType extends string, TComplete extends z.ZodTypeAny> {
16
- /**
17
- * The unique identifier for the contract.
18
- */
19
- uri: TUri;
20
- /**
21
- * Configuration for the initialization event.
22
- */
23
- init: {
24
- /**
25
- * The type identifier for the initialization event.
26
- */
27
- type: TInitType;
28
- /**
29
- * The Zod schema used to validate the initialization event data.
30
- */
31
- schema: TInit;
32
- };
33
- /**
34
- * Configuration for the completion event.
35
- */
36
- complete: {
37
- /**
38
- * The type identifier for the completion event.
39
- */
40
- type: TCompleteType;
41
- /**
42
- * The Zod schema used to validate the completion event data.
43
- */
44
- schema: TComplete;
33
+ export type ArvoOrchestratorContract<TUri extends string = string, TType extends string = string, TVersions extends Record<ArvoSemanticVersion, {
34
+ init: z.ZodObject<any, any, any>;
35
+ complete: z.ZodObject<any, any, any>;
36
+ }> = Record<ArvoSemanticVersion, {
37
+ init: z.ZodObject<any, any, any>;
38
+ complete: z.ZodObject<any, any, any>;
39
+ }>> = ArvoContract<TUri, ReturnType<typeof ArvoOrchestratorEventTypeGen.init<TType>>, {
40
+ [V in ArvoSemanticVersion & keyof TVersions]: {
41
+ accepts: ReturnType<typeof OrchestrationInitEventBaseSchema.merge<TVersions[V]['init'], TVersions[V]['init']['shape']>>;
42
+ emits: {
43
+ [K in ReturnType<typeof ArvoOrchestratorEventTypeGen.complete<TType>>]: TVersions[V]['complete'];
44
+ };
45
45
  };
46
- }
46
+ }>;
47
47
  /**
48
- * Interface for creating an Arvo Orchestrator Contract.
48
+ * Interface defining the configuration structure for creating an Arvo Orchestrator Contract.
49
+ * This interface specifies the required properties for initializing a new orchestrator contract.
49
50
  *
50
- * This interface defines the structure of the configuration object used to create
51
- * an ArvoOrchestratorContract. It specifies the URI, name, and schemas for both
52
- * the initialization and completion events of the orchestration process.
51
+ * @template TUri - The URI type that uniquely identifies the contract
52
+ * @template TType - The base event type for the orchestrator
53
+ * @template TVersions - Record of versioned schemas for init and complete events
53
54
  *
54
- * @template TUri - The type for the URI string that uniquely identifies the contract.
55
- * @template TName - The type for the name of the contract.
56
- * @template TInit - The Zod schema type for validating the initialization event data.
57
- * @template TComplete - The Zod schema type for validating the completion event data.
55
+ * @property uri - The unique identifier URI for the contract
56
+ * @property type - The base event type that will be used to generate init/complete event types
57
+ * @property versions - A record of version-specific schemas for initialization and completion events
58
+ *
59
+ * @remarks
60
+ * - The URI should be unique within your system
61
+ * - The type will be used to generate appropriate event type strings
62
+ * - Each version must conform to {@link ArvoSemanticVersion} format
63
+ * - Init and complete schemas should use Zod for validation
58
64
  */
59
- export interface ICreateArvoOrchestratorContract<TUri extends string, TName extends string, TInit extends z.ZodTypeAny, TComplete extends z.ZodTypeAny> {
60
- /**
61
- * The unique identifier for the contract.
62
- * This URI should be used to reference the contract within the system.
63
- */
65
+ export interface ICreateArvoOrchestratorContract<TUri extends string, TType extends string, TVersions extends Record<ArvoSemanticVersion, {
66
+ init: z.ZodTypeAny;
67
+ complete: z.ZodTypeAny;
68
+ }>> {
69
+ /** Unique identifier URI for the contract */
64
70
  uri: TUri;
71
+ /** Base event type used for generating init/complete event types */
72
+ type: TType;
65
73
  /**
66
- * The name of the contract.
67
- * This can be used for display purposes or for easier identification of the contract.
68
- */
69
- name: TName;
70
- /**
71
- * The schema definitions for the contract events.
74
+ * Version-specific schemas for initialization and completion events
75
+ * @remarks Each version must provide both init and complete schemas
72
76
  */
73
- schema: {
74
- /**
75
- * The Zod schema used to validate the initialization event data.
76
- * This schema defines the structure and types of the data required to start the orchestration process.
77
- */
78
- init: TInit;
79
- /**
80
- * The Zod schema used to validate the completion event data.
81
- * This schema defines the structure and types of the data emitted when the orchestration process completes.
82
- */
83
- complete: TComplete;
84
- };
77
+ versions: TVersions;
85
78
  }
package/dist/index.d.ts CHANGED
@@ -3,32 +3,28 @@ import { ArvoDataContentType } from './ArvoEvent/schema';
3
3
  import { createArvoEvent } from './ArvoEvent/helpers';
4
4
  import { CloudEventContext, CloudEventExtension, ArvoEventData, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent } from './ArvoEvent/types';
5
5
  import { exceptionToSpan, logToSpan, OTelNull, currentOpenTelemetryHeaders } from './OpenTelemetry';
6
- import { OpenTelemetryHeaders, TelemetryLogLevel } from './OpenTelemetry/types';
7
- import { validateURI, cleanString } from './utils';
6
+ import { OpenTelemetryHeaders, TelemetryLogLevel, ExecutionOpenTelemetryConfiguration } from './OpenTelemetry/types';
7
+ import { validateURI, cleanString, compareSemanticVersions, parseSemanticVersion } from './utils';
8
8
  import ArvoContract from './ArvoContract';
9
- import { createArvoContract, InferArvoContract as InferArvoContractType } from './ArvoContract/helpers';
9
+ import { createArvoContract, createSimpleArvoContract } from './ArvoContract/helpers';
10
10
  import { ArvoContractValidators } from './ArvoContract/validators';
11
11
  import { ArvoContractRecord, IArvoContract, ResolveArvoContractRecord, ArvoContractJSONSchema } from './ArvoContract/types';
12
- import ArvoContractLibrary from './ArvoContractLibrary';
13
- import { createArvoContractLibrary } from './ArvoContractLibrary/helpers';
14
12
  import ArvoEventFactory from './ArvoEventFactory';
15
- import { createArvoEventFactory } from './ArvoEventFactory/helpers';
16
- import { ArvoErrorSchema } from './schema';
13
+ import { createArvoEventFactory, parseEventDataSchema } from './ArvoEventFactory/helpers';
14
+ import { ArvoErrorSchema, ArvoSemanticVersionSchema } from './schema';
17
15
  import OpenInference from './OpenTelemetry/OpenInference';
18
16
  import ArvoExecution from './OpenTelemetry/ArvoExecution';
19
17
  import { ArvoExecutionSpanKind } from './OpenTelemetry/ArvoExecution/types';
20
18
  import { OpenInferenceSpanKind } from './OpenTelemetry/OpenInference/types';
21
19
  import ArvoOrchestrationSubject from './ArvoOrchestrationSubject';
22
- import { ArvoOrchestrationSubjectContentSchema, ArvoOrchestratorVersionSchema } from './ArvoOrchestrationSubject/schema';
23
- import { ArvoOrchestrationSubjectContent, ArvoOrchestratorVersion } from './ArvoOrchestrationSubject/type';
20
+ import { ArvoOrchestrationSubjectContentSchema } from './ArvoOrchestrationSubject/schema';
21
+ import { ArvoOrchestrationSubjectContent } from './ArvoOrchestrationSubject/type';
24
22
  import ArvoEventHttp from './ArvoEventHttp';
25
23
  import { ArvoEventHttpConfig } from './ArvoEventHttp/types';
26
- import { InferArvoContract, InferArvoEvent, InferArvoOrchestratorContract } from './types';
27
- import { createArvoOrchestratorContract } from './ArvoOrchestratorContract/helpers';
28
- import ArvoOrchestratorContract from './ArvoOrchestratorContract';
29
- import { ICreateArvoOrchestratorContract, IArvoOrchestratorContract } from './ArvoOrchestratorContract/types';
24
+ import { InferArvoContract, InferArvoEvent, ArvoSemanticVersion, ArvoErrorType } from './types';
25
+ import { createArvoOrchestratorContract } from './ArvoOrchestratorContract';
26
+ import { ICreateArvoOrchestratorContract } from './ArvoOrchestratorContract/types';
30
27
  import { ArvoOrchestratorEventTypeGen } from './ArvoOrchestratorContract/typegen';
31
- import { ExecutionOpenTelemetryConfiguration } from './OpenTelemetry/types';
32
28
  /**
33
29
  * Collection of Zod schemas for validating various aspects of Arvo events.
34
30
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
@@ -38,7 +34,7 @@ import { ExecutionOpenTelemetryConfiguration } from './OpenTelemetry/types';
38
34
  * @property {z.ZodObject} OpenTelemetryExtensionSchema - Schema for OpenTelemetry extensions.
39
35
  * @property {z.ZodObject} OrchestrationInitEventBaseSchema - The base schema for the orchestrator init events.
40
36
  */
41
- declare const ArvoEventSchemas: {
37
+ declare const ArvoEventSchema: {
42
38
  CloudEventContextSchema: import("zod").ZodObject<{
43
39
  id: import("zod").ZodString;
44
40
  time: import("zod").ZodString;
@@ -49,20 +45,20 @@ declare const ArvoEventSchemas: {
49
45
  datacontenttype: import("zod").ZodDefault<import("zod").ZodEffects<import("zod").ZodString, string, string>>;
50
46
  dataschema: import("zod").ZodNullable<import("zod").ZodEffects<import("zod").ZodString, string, string>>;
51
47
  }, "strip", import("zod").ZodTypeAny, {
48
+ type: string;
52
49
  id: string;
53
50
  time: string;
54
51
  source: string;
55
52
  specversion: "1.0";
56
- type: string;
57
53
  subject: string;
58
54
  datacontenttype: string;
59
55
  dataschema: string | null;
60
56
  }, {
57
+ type: string;
61
58
  id: string;
62
59
  time: string;
63
60
  source: string;
64
61
  specversion: string;
65
- type: string;
66
62
  subject: string;
67
63
  dataschema: string | null;
68
64
  datacontenttype?: string | undefined;
@@ -103,4 +99,4 @@ declare const ArvoEventSchemas: {
103
99
  parentSubject$$: string | null;
104
100
  }>;
105
101
  };
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, };
102
+ export { ArvoEventHttpConfig, ArvoEventHttp, ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchema, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, IArvoContract, ResolveArvoContractRecord, ArvoEventFactory, createArvoEventFactory, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContent, ArvoSemanticVersion, InferArvoEvent, InferArvoContract, createArvoOrchestratorContract, ICreateArvoOrchestratorContract, ArvoOrchestratorEventTypeGen, ExecutionOpenTelemetryConfiguration, parseEventDataSchema, ArvoOrchestrationSubjectContentSchema, ArvoSemanticVersionSchema, ArvoErrorSchema, ArvoErrorType, compareSemanticVersions, parseSemanticVersion, createSimpleArvoContract, };
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.ArvoOrchestratorEventTypeGen = exports.ArvoOrchestratorContract = exports.createArvoOrchestratorContract = exports.ArvoOrchestratorVersionSchema = 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;
6
+ exports.createSimpleArvoContract = exports.parseSemanticVersion = exports.compareSemanticVersions = exports.ArvoErrorSchema = exports.ArvoSemanticVersionSchema = exports.ArvoOrchestrationSubjectContentSchema = exports.parseEventDataSchema = exports.ArvoOrchestratorEventTypeGen = exports.createArvoOrchestratorContract = exports.ArvoOrchestrationSubject = exports.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchema = 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");
@@ -18,22 +18,23 @@ Object.defineProperty(exports, "currentOpenTelemetryHeaders", { enumerable: true
18
18
  var utils_1 = require("./utils");
19
19
  Object.defineProperty(exports, "validateURI", { enumerable: true, get: function () { return utils_1.validateURI; } });
20
20
  Object.defineProperty(exports, "cleanString", { enumerable: true, get: function () { return utils_1.cleanString; } });
21
+ Object.defineProperty(exports, "compareSemanticVersions", { enumerable: true, get: function () { return utils_1.compareSemanticVersions; } });
22
+ Object.defineProperty(exports, "parseSemanticVersion", { enumerable: true, get: function () { return utils_1.parseSemanticVersion; } });
21
23
  var ArvoContract_1 = __importDefault(require("./ArvoContract"));
22
24
  exports.ArvoContract = ArvoContract_1.default;
23
25
  var helpers_2 = require("./ArvoContract/helpers");
24
26
  Object.defineProperty(exports, "createArvoContract", { enumerable: true, get: function () { return helpers_2.createArvoContract; } });
27
+ Object.defineProperty(exports, "createSimpleArvoContract", { enumerable: true, get: function () { return helpers_2.createSimpleArvoContract; } });
25
28
  var validators_1 = require("./ArvoContract/validators");
26
29
  Object.defineProperty(exports, "ArvoContractValidators", { enumerable: true, get: function () { return validators_1.ArvoContractValidators; } });
27
- var ArvoContractLibrary_1 = __importDefault(require("./ArvoContractLibrary"));
28
- exports.ArvoContractLibrary = ArvoContractLibrary_1.default;
29
- var helpers_3 = require("./ArvoContractLibrary/helpers");
30
- Object.defineProperty(exports, "createArvoContractLibrary", { enumerable: true, get: function () { return helpers_3.createArvoContractLibrary; } });
31
30
  var ArvoEventFactory_1 = __importDefault(require("./ArvoEventFactory"));
32
31
  exports.ArvoEventFactory = ArvoEventFactory_1.default;
33
- var helpers_4 = require("./ArvoEventFactory/helpers");
34
- Object.defineProperty(exports, "createArvoEventFactory", { enumerable: true, get: function () { return helpers_4.createArvoEventFactory; } });
32
+ var helpers_3 = require("./ArvoEventFactory/helpers");
33
+ Object.defineProperty(exports, "createArvoEventFactory", { enumerable: true, get: function () { return helpers_3.createArvoEventFactory; } });
34
+ Object.defineProperty(exports, "parseEventDataSchema", { enumerable: true, get: function () { return helpers_3.parseEventDataSchema; } });
35
35
  var schema_2 = require("./schema");
36
36
  Object.defineProperty(exports, "ArvoErrorSchema", { enumerable: true, get: function () { return schema_2.ArvoErrorSchema; } });
37
+ Object.defineProperty(exports, "ArvoSemanticVersionSchema", { enumerable: true, get: function () { return schema_2.ArvoSemanticVersionSchema; } });
37
38
  var OpenInference_1 = __importDefault(require("./OpenTelemetry/OpenInference"));
38
39
  exports.OpenInference = OpenInference_1.default;
39
40
  var ArvoExecution_1 = __importDefault(require("./OpenTelemetry/ArvoExecution"));
@@ -46,13 +47,10 @@ var ArvoOrchestrationSubject_1 = __importDefault(require("./ArvoOrchestrationSub
46
47
  exports.ArvoOrchestrationSubject = ArvoOrchestrationSubject_1.default;
47
48
  var schema_3 = require("./ArvoOrchestrationSubject/schema");
48
49
  Object.defineProperty(exports, "ArvoOrchestrationSubjectContentSchema", { enumerable: true, get: function () { return schema_3.ArvoOrchestrationSubjectContentSchema; } });
49
- Object.defineProperty(exports, "ArvoOrchestratorVersionSchema", { enumerable: true, get: function () { return schema_3.ArvoOrchestratorVersionSchema; } });
50
50
  var ArvoEventHttp_1 = __importDefault(require("./ArvoEventHttp"));
51
51
  exports.ArvoEventHttp = ArvoEventHttp_1.default;
52
- var helpers_5 = require("./ArvoOrchestratorContract/helpers");
53
- Object.defineProperty(exports, "createArvoOrchestratorContract", { enumerable: true, get: function () { return helpers_5.createArvoOrchestratorContract; } });
54
- var ArvoOrchestratorContract_1 = __importDefault(require("./ArvoOrchestratorContract"));
55
- exports.ArvoOrchestratorContract = ArvoOrchestratorContract_1.default;
52
+ var ArvoOrchestratorContract_1 = require("./ArvoOrchestratorContract");
53
+ Object.defineProperty(exports, "createArvoOrchestratorContract", { enumerable: true, get: function () { return ArvoOrchestratorContract_1.createArvoOrchestratorContract; } });
56
54
  var typegen_1 = require("./ArvoOrchestratorContract/typegen");
57
55
  Object.defineProperty(exports, "ArvoOrchestratorEventTypeGen", { enumerable: true, get: function () { return typegen_1.ArvoOrchestratorEventTypeGen; } });
58
56
  var schema_4 = require("./ArvoOrchestratorContract/schema");
@@ -65,7 +63,7 @@ var schema_4 = require("./ArvoOrchestratorContract/schema");
65
63
  * @property {z.ZodObject} OpenTelemetryExtensionSchema - Schema for OpenTelemetry extensions.
66
64
  * @property {z.ZodObject} OrchestrationInitEventBaseSchema - The base schema for the orchestrator init events.
67
65
  */
68
- var ArvoEventSchemas = {
66
+ var ArvoEventSchema = {
69
67
  CloudEventContextSchema: schema_1.CloudEventContextSchema,
70
68
  CloudEventExtensionSchema: schema_1.CloudEventExtensionSchema,
71
69
  ArvoDataSchema: schema_1.ArvoDataSchema,
@@ -73,4 +71,4 @@ var ArvoEventSchemas = {
73
71
  OpenTelemetryExtensionSchema: schema_1.OpenTelemetryExtensionSchema,
74
72
  OrchestrationInitEventBaseSchema: schema_4.OrchestrationInitEventBaseSchema,
75
73
  };
76
- exports.ArvoEventSchemas = ArvoEventSchemas;
74
+ exports.ArvoEventSchema = ArvoEventSchema;
package/dist/schema.d.ts CHANGED
@@ -18,3 +18,4 @@ export declare const ArvoErrorSchema: z.ZodObject<{
18
18
  errorName: string;
19
19
  errorStack: string | null;
20
20
  }>;
21
+ export declare const ArvoSemanticVersionSchema: z.ZodString;
package/dist/schema.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ArvoErrorSchema = void 0;
3
+ exports.ArvoSemanticVersionSchema = exports.ArvoErrorSchema = void 0;
4
4
  var zod_1 = require("zod");
5
5
  /**
6
6
  * Schema for Arvo error objects.
@@ -13,3 +13,8 @@ exports.ArvoErrorSchema = zod_1.z.object({
13
13
  errorMessage: zod_1.z.string().describe('A descriptive message for the error.'),
14
14
  errorStack: zod_1.z.string().nullable().describe('The stack trace of the error.'),
15
15
  });
16
+ // Zod schema for ArvoSemanticVersion
17
+ exports.ArvoSemanticVersionSchema = zod_1.z
18
+ .string()
19
+ .regex(/^\d+\.\d+\.\d+$/, 'Invalid version format of the semantic version')
20
+ .describe('Semantic version of the Arvo component in the format X.Y.Z');