arvo-core 1.2.2 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/dist/ArvoContract/helpers.d.ts +119 -20
- package/dist/ArvoContract/helpers.js +150 -32
- package/dist/ArvoContract/index.d.ts +32 -26
- package/dist/ArvoContract/index.js +69 -60
- package/dist/ArvoContract/types.d.ts +49 -35
- package/dist/ArvoEvent/schema.d.ts +2 -2
- package/dist/ArvoEventFactory/helpers.d.ts +39 -9
- package/dist/ArvoEventFactory/helpers.js +50 -8
- package/dist/ArvoEventFactory/index.d.ts +60 -33
- package/dist/ArvoEventFactory/index.js +62 -36
- package/dist/ArvoOrchestrationSubject/index.d.ts +5 -4
- package/dist/ArvoOrchestrationSubject/index.js +2 -2
- package/dist/ArvoOrchestrationSubject/schema.d.ts +1 -2
- package/dist/ArvoOrchestrationSubject/schema.js +4 -11
- package/dist/ArvoOrchestrationSubject/type.d.ts +2 -12
- package/dist/ArvoOrchestratorContract/index.d.ts +62 -56
- package/dist/ArvoOrchestratorContract/index.js +99 -93
- package/dist/ArvoOrchestratorContract/types.d.ts +64 -71
- package/dist/index.d.ts +14 -18
- package/dist/index.js +12 -14
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +6 -1
- package/dist/types.d.ts +107 -81
- package/dist/utils.d.ts +21 -0
- package/dist/utils.js +33 -0
- package/package.json +1 -1
- package/dist/ArvoContractLibrary/helpers.d.ts +0 -10
- package/dist/ArvoContractLibrary/helpers.js +0 -22
- package/dist/ArvoContractLibrary/index.d.ts +0 -61
- package/dist/ArvoContractLibrary/index.js +0 -87
- package/dist/ArvoOrchestratorContract/helpers.d.ts +0 -67
- 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
|
-
|
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
|
-
*
|
25
|
+
* Creates an ArvoOrchestratorContract with specified parameters.
|
24
26
|
*
|
25
|
-
* The ArvoOrchestratorContract is a specialized contract
|
26
|
-
* of orchestration processes within the Arvo framework. It
|
27
|
-
*
|
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.
|
31
|
-
* 2.
|
32
|
-
* 3.
|
33
|
-
* 4.
|
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
|
-
*
|
36
|
-
*
|
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
|
-
*
|
45
|
-
*
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
50
|
-
*
|
51
|
-
*
|
52
|
-
*
|
53
|
-
*
|
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
|
60
|
-
|
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
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
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
|
-
*
|
6
|
-
*
|
7
|
-
*
|
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
|
-
* @
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
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
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
*
|
51
|
-
*
|
52
|
-
*
|
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
|
-
* @
|
55
|
-
* @
|
56
|
-
* @
|
57
|
-
*
|
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,
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
*
|
67
|
-
*
|
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
|
-
|
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,
|
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
|
23
|
-
import { ArvoOrchestrationSubjectContent
|
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,
|
27
|
-
import { createArvoOrchestratorContract } from './ArvoOrchestratorContract
|
28
|
-
import
|
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
|
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,
|
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.
|
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
|
34
|
-
Object.defineProperty(exports, "createArvoEventFactory", { enumerable: true, get: function () { return
|
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
|
53
|
-
Object.defineProperty(exports, "createArvoOrchestratorContract", { enumerable: true, get: function () { return
|
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
|
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.
|
74
|
+
exports.ArvoEventSchema = ArvoEventSchema;
|
package/dist/schema.d.ts
CHANGED
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');
|