arvo-core 3.0.13 → 3.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ArvoContract/VersionedArvoContract/index.d.ts +2 -2
- package/dist/ArvoContract/VersionedArvoContract/types.d.ts +2 -2
- package/dist/ArvoContract/index.d.ts +3 -3
- package/dist/ArvoContract/types.d.ts +3 -3
- package/dist/ArvoOrchestratorContract/index.d.ts +2 -2
- package/dist/ArvoOrchestratorContract/types.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import type { ArvoSemanticVersion } from '../../types';
|
|
|
3
3
|
import { EventDataschemaUtil } from '../../utils';
|
|
4
4
|
import { WildCardArvoSemanticVersion } from '../WildCardArvoSemanticVersion';
|
|
5
5
|
import type { ArvoContractRecord } from '../types';
|
|
6
|
-
import type {
|
|
6
|
+
import type { VersionedArvoContractJSONSchema, VersionedArvoContractParam } from './types';
|
|
7
7
|
import { transformEmitsToArray } from './utils';
|
|
8
8
|
/**
|
|
9
9
|
* Implements a version-specific view of an ArvoContract with type-safe schema validation
|
|
@@ -27,7 +27,7 @@ export declare class VersionedArvoContract<TContract extends ArvoContract, TVers
|
|
|
27
27
|
get emitList(): { [K in keyof TContract["versions"][TVersion]["emits"] & string]: ArvoContractRecord<K, TContract["versions"][TVersion]["emits"][K]>; }[keyof TContract["versions"][TVersion]["emits"] & string][];
|
|
28
28
|
get dataschema(): `${TContract["uri"]}/${TVersion}`;
|
|
29
29
|
get domain(): string | null;
|
|
30
|
-
constructor(param:
|
|
30
|
+
constructor(param: VersionedArvoContractParam<TContract, TVersion>);
|
|
31
31
|
/**
|
|
32
32
|
* Converts the contract to JSON Schema format
|
|
33
33
|
* @returns Contract specification in JSON Schema format for documentation/serialization
|
|
@@ -6,10 +6,10 @@ import type { ArvoSemanticVersion } from '../../types';
|
|
|
6
6
|
* to contract specifications for a particular semantic version. This interface acts as
|
|
7
7
|
* a bridge between the base contract and its versioned implementation.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type VersionedArvoContractParam<TContract extends ArvoContract, TVersion extends ArvoSemanticVersion & keyof TContract['versions']> = {
|
|
10
10
|
contract: TContract;
|
|
11
11
|
version: TVersion;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
13
|
/**
|
|
14
14
|
* Represents the standardized JSON Schema structure for an Arvo contract record.
|
|
15
15
|
* This type is used when converting Zod schemas to JSON Schema format for documentation
|
|
@@ -2,7 +2,7 @@ import type { z } from 'zod';
|
|
|
2
2
|
import { ArvoErrorSchema } from '../schema';
|
|
3
3
|
import type { ArvoSemanticVersion } from '../types';
|
|
4
4
|
import { VersionedArvoContract } from './VersionedArvoContract';
|
|
5
|
-
import type { ArvoContractJSONSchema,
|
|
5
|
+
import type { ArvoContractJSONSchema, ArvoContractParam, ArvoContractRecord } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Represents a contract with defined input and output schemas for event-driven architectures.
|
|
8
8
|
* The ArvoContract class provides type-safe validation and versioning capabilities for event handling,
|
|
@@ -66,7 +66,7 @@ export default class ArvoContract<TUri extends string = string, TType extends st
|
|
|
66
66
|
* @throws {Error} When no versions are provided
|
|
67
67
|
* @throws {Error} When domain does not have follow the condition Domain must contain only lowercase letters, numbers, and dots
|
|
68
68
|
*/
|
|
69
|
-
constructor(params:
|
|
69
|
+
constructor(params: ArvoContractParam<TUri, TType, TVersions, TMetaData>);
|
|
70
70
|
/**
|
|
71
71
|
* Gets the system error event specification for this contract.
|
|
72
72
|
* System errors follow a standardized format to handle exceptional conditions
|
|
@@ -106,7 +106,7 @@ export default class ArvoContract<TUri extends string = string, TType extends st
|
|
|
106
106
|
* Exports the ArvoContract instance as a plain object conforming to the IArvoContract interface.
|
|
107
107
|
* This method can be used to serialize the contract or to create a new instance with the same parameters.
|
|
108
108
|
*/
|
|
109
|
-
export():
|
|
109
|
+
export(): ArvoContractParam<TUri, TType, TVersions>;
|
|
110
110
|
/**
|
|
111
111
|
* Converts the ArvoContract instance to a JSON Schema representation.
|
|
112
112
|
* This method provides a way to represent the contract's structure and validation rules
|
|
@@ -27,13 +27,13 @@ export type ResolveArvoContractRecord<T extends ArvoContractRecord> = z.infer<T[
|
|
|
27
27
|
* @template TVersions - A record of versioned schemas, mapping semantic versions to their accept/emit schemas
|
|
28
28
|
* @template TMetaData - Optional metadata type
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export type ArvoContractParam<TUri extends string = string, TType extends string = string, TVersions extends Record<ArvoSemanticVersion, {
|
|
31
31
|
accepts: z.ZodTypeAny;
|
|
32
32
|
emits: Record<string, z.ZodTypeAny>;
|
|
33
33
|
}> = Record<ArvoSemanticVersion, {
|
|
34
34
|
accepts: z.ZodTypeAny;
|
|
35
35
|
emits: Record<string, z.ZodTypeAny>;
|
|
36
|
-
}>, TMetaData extends Record<string, any> = Record<string, any>> {
|
|
36
|
+
}>, TMetaData extends Record<string, any> = Record<string, any>> = {
|
|
37
37
|
/** The unique URI identifier for this contract */
|
|
38
38
|
uri: TUri;
|
|
39
39
|
/** The event type that this contract's handler accepts */
|
|
@@ -46,7 +46,7 @@ export interface IArvoContract<TUri extends string = string, TType extends strin
|
|
|
46
46
|
versions: TVersions;
|
|
47
47
|
/** The domain of the contract handler */
|
|
48
48
|
domain: string | null;
|
|
49
|
-
}
|
|
49
|
+
};
|
|
50
50
|
/**
|
|
51
51
|
* Represents the JSON Schema representation of an ArvoContract, used for serialization
|
|
52
52
|
* and documentation purposes. This structure follows the JSON Schema specification.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { ArvoSemanticVersion } from '../types';
|
|
3
|
-
import type { ArvoOrchestratorContract,
|
|
3
|
+
import type { ArvoOrchestratorContract, CreateArvoOrchestratorContractParam } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Creates an ArvoOrchestratorContract with specified parameters.
|
|
6
6
|
*
|
|
@@ -62,4 +62,4 @@ import type { ArvoOrchestratorContract, ICreateArvoOrchestratorContract } from '
|
|
|
62
62
|
export declare const createArvoOrchestratorContract: <TUri extends string, TName extends string, TVersions extends Record<ArvoSemanticVersion, {
|
|
63
63
|
init: z.ZodObject<any, any, any>;
|
|
64
64
|
complete: z.ZodObject<any, any, any>;
|
|
65
|
-
}>, TMetaData extends Record<string, any>>(contract:
|
|
65
|
+
}>, TMetaData extends Record<string, any>>(contract: CreateArvoOrchestratorContractParam<TUri, TName, TVersions, TMetaData>) => ArvoOrchestratorContract<TUri, TName, TVersions, TMetaData>;
|
|
@@ -59,14 +59,14 @@ export type ArvoOrchestratorContract<TUri extends string = string, TName extends
|
|
|
59
59
|
* - The type will be used to generate appropriate event type strings
|
|
60
60
|
* - Each version must conform to {@link ArvoSemanticVersion} format
|
|
61
61
|
*/
|
|
62
|
-
export
|
|
62
|
+
export type CreateArvoOrchestratorContractParam<TUri extends string, TName extends string, TVersions extends Record<ArvoSemanticVersion, {
|
|
63
63
|
init: z.ZodTypeAny;
|
|
64
64
|
complete: z.ZodTypeAny;
|
|
65
|
-
}>, TMetaData extends Record<string, any>> {
|
|
65
|
+
}>, TMetaData extends Record<string, any>> = {
|
|
66
66
|
uri: TUri;
|
|
67
67
|
name: TName;
|
|
68
68
|
versions: TVersions;
|
|
69
69
|
metadata?: TMetaData;
|
|
70
70
|
description?: string;
|
|
71
71
|
domain?: string;
|
|
72
|
-
}
|
|
72
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { createSimpleArvoContract } from './ArvoContract/SimpleArvoContract';
|
|
|
11
11
|
import { SimpleArvoContract } from './ArvoContract/SimpleArvoContract/types';
|
|
12
12
|
import { VersionedArvoContract } from './ArvoContract/VersionedArvoContract';
|
|
13
13
|
import { WildCardArvoSemanticVersion, isWildCardArvoSematicVersion } from './ArvoContract/WildCardArvoSemanticVersion';
|
|
14
|
-
import { ArvoContractJSONSchema,
|
|
14
|
+
import { ArvoContractJSONSchema, ArvoContractParam, ArvoContractRecord, ResolveArvoContractRecord } from './ArvoContract/types';
|
|
15
15
|
import { ArvoContractValidators } from './ArvoContract/validators';
|
|
16
16
|
import { ArvoEventIdObject, ArvoEventIdObjectSchema, createArvoEventId, parseArvoEventId } from './ArvoEvent/id';
|
|
17
17
|
import ArvoEventFactory from './ArvoEventFactory';
|
|
@@ -22,7 +22,7 @@ import { ArvoOrchestrationSubjectContentSchema } from './ArvoOrchestrationSubjec
|
|
|
22
22
|
import { ArvoOrchestrationSubjectContent } from './ArvoOrchestrationSubject/type';
|
|
23
23
|
import { createArvoOrchestratorContract } from './ArvoOrchestratorContract';
|
|
24
24
|
import { ArvoOrchestratorEventTypeGen } from './ArvoOrchestratorContract/typegen';
|
|
25
|
-
import { ArvoOrchestratorContract,
|
|
25
|
+
import { ArvoOrchestratorContract, CreateArvoOrchestratorContractParam } from './ArvoOrchestratorContract/types';
|
|
26
26
|
import { ArvoExecution, ArvoExecutionSpanKind } from './OpenTelemetry/ArvoExecution';
|
|
27
27
|
import { OpenInference, OpenInferenceSpanKind } from './OpenTelemetry/OpenInference';
|
|
28
28
|
import { ViolationError, ViolationErrorParam, isViolationError } from './errors';
|
|
@@ -108,4 +108,4 @@ declare const ArvoEventSchema: {
|
|
|
108
108
|
parentSubject$$: string | null;
|
|
109
109
|
}>;
|
|
110
110
|
};
|
|
111
|
-
export { 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, createArvoOrchestratorContract, ICreateArvoOrchestratorContract, ArvoOrchestratorEventTypeGen, EventDataschemaUtil, ArvoOrchestrationSubjectContentSchema, ArvoSemanticVersionSchema, ArvoErrorSchema, ArvoErrorType, compareSemanticVersions, parseSemanticVersion, createSimpleArvoContract, ArvoOrchestratorContract, VersionedArvoContract, InferVersionedArvoContract, isWildCardArvoSematicVersion, WildCardArvoSemanticVersion, isValidArvoSemanticVersion, SimpleArvoContract, ArvoOrchestratorEventFactory, createArvoOrchestratorEventFactory, ArvoOpenTelemetry, ViolationError, ViolationErrorParam, createArvoError, createArvoEventId, parseArvoEventId, ArvoEventIdObjectSchema, ArvoEventIdObject, isViolationError, getOtelHeaderFromSpan, };
|
|
111
|
+
export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchema, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, ArvoContractParam as IArvoContract, ResolveArvoContractRecord, ArvoEventFactory, createArvoEventFactory, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContent, ArvoSemanticVersion, InferArvoEvent, createArvoOrchestratorContract, CreateArvoOrchestratorContractParam as ICreateArvoOrchestratorContract, ArvoOrchestratorEventTypeGen, EventDataschemaUtil, ArvoOrchestrationSubjectContentSchema, ArvoSemanticVersionSchema, ArvoErrorSchema, ArvoErrorType, compareSemanticVersions, parseSemanticVersion, createSimpleArvoContract, ArvoOrchestratorContract, VersionedArvoContract, InferVersionedArvoContract, isWildCardArvoSematicVersion, WildCardArvoSemanticVersion, isValidArvoSemanticVersion, SimpleArvoContract, ArvoOrchestratorEventFactory, createArvoOrchestratorEventFactory, ArvoOpenTelemetry, ViolationError, ViolationErrorParam, createArvoError, createArvoEventId, parseArvoEventId, ArvoEventIdObjectSchema, ArvoEventIdObject, isViolationError, getOtelHeaderFromSpan, };
|
package/dist/utils.d.ts
CHANGED
|
@@ -56,11 +56,11 @@ export declare const createTimestamp: (offsetHours?: number) => string;
|
|
|
56
56
|
* @param version Semantic version string (e.g. "1.2.3")
|
|
57
57
|
* @returns Object containing major, minor, and patch numbers
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
type VersionComponents = {
|
|
60
60
|
major: number;
|
|
61
61
|
minor: number;
|
|
62
62
|
patch: number;
|
|
63
|
-
}
|
|
63
|
+
};
|
|
64
64
|
export declare function parseSemanticVersion(version: ArvoSemanticVersion): VersionComponents;
|
|
65
65
|
/**
|
|
66
66
|
* Compares two semantic versions according to semver rules
|