arvo-core
Version:
This core package contains all the core classes and components of the Arvo Event Driven System
37 lines (36 loc) • 2.15 kB
TypeScript
import type ArvoContract from '..';
import type { ArvoSemanticVersion } from '../../types';
import { EventDataschemaUtil } from '../../utils';
import { WildCardArvoSemanticVersion } from '../WildCardArvoSemanticVersion';
import type { ArvoContractRecord } from '../types';
import type { IVersionedArvoContract, VersionedArvoContractJSONSchema } from './types';
import { transformEmitsToArray } from './utils';
/**
* Implements a version-specific view of an ArvoContract with type-safe schema validation
* and JSON Schema generation capabilities.
*/
export declare class VersionedArvoContract<TContract extends ArvoContract, TVersion extends ArvoSemanticVersion & keyof TContract['versions']> {
protected readonly _contract: TContract;
protected readonly _version: TVersion;
protected readonly _accepts: ArvoContractRecord<TContract['type'], TContract['versions'][TVersion]['accepts']>;
protected readonly _emits: TContract['versions'][TVersion]['emits'];
protected readonly _emitList: ReturnType<typeof transformEmitsToArray<TContract, TVersion>>;
get uri(): TContract['uri'];
get version(): TVersion;
get description(): TContract['description'];
get metadata(): TContract['metadata'];
get systemError(): TContract['systemError'] & {
dataschema: ReturnType<typeof EventDataschemaUtil.build<TContract['uri'], typeof WildCardArvoSemanticVersion>>;
};
get accepts(): ArvoContractRecord<TContract["type"], TContract["versions"][TVersion]["accepts"]>;
get emits(): TContract["versions"][TVersion]["emits"];
get emitList(): { [K in keyof TContract["versions"][TVersion]["emits"] & string]: ArvoContractRecord<K, TContract["versions"][TVersion]["emits"][K]>; }[keyof TContract["versions"][TVersion]["emits"] & string][];
get dataschema(): `${TContract["uri"]}/${TVersion}`;
get domain(): string | null;
constructor(param: IVersionedArvoContract<TContract, TVersion>);
/**
* Converts the contract to JSON Schema format
* @returns Contract specification in JSON Schema format for documentation/serialization
*/
toJsonSchema(): VersionedArvoContractJSONSchema;
}