arvo-core
Version:
The core Arvo package which provides application tier core primitives and contract system for building production-grade event-driven application. Provides ArvoEvent (CloudEvents-compliant), ArvoContract for type-safe service interfaces, event factories, O
93 lines (92 loc) • 3.38 kB
TypeScript
import { z } from 'zod';
/**
* The content type for Arvo data in CloudEvents.
* This is the recommended content type for Arvo events.
*/
export declare const ArvoDataContentType = "application/cloudevents+json;charset=UTF-8;profile=arvo";
/**
* Zod schema for validating the core properties of a CloudEvent.
* This schema defines the structure and validation rules for the mandatory
* and optional attributes of a CloudEvent as per the CloudEvents specification.
*/
export declare const CloudEventContextSchema: z.ZodObject<{
id: z.ZodString;
time: z.ZodString;
source: z.ZodEffects<z.ZodString, string, string>;
specversion: z.ZodEffects<z.ZodString, "1.0", string>;
type: z.ZodString;
subject: z.ZodEffects<z.ZodString, string, string>;
datacontenttype: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
dataschema: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
}, "strip", z.ZodTypeAny, {
type: string;
id: string;
time: string;
source: string;
specversion: "1.0";
subject: string;
datacontenttype: string;
dataschema: string | null;
}, {
type: string;
id: string;
time: string;
source: string;
specversion: string;
subject: string;
dataschema: string | null;
datacontenttype?: string | undefined;
}>;
/**
* Zod schema for validating custom CloudEvent extensions.
* This schema allows for additional custom fields in the CloudEvent,
* following the CloudEvents specification for extension attributes.
*/
export declare const CloudEventExtensionSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodNull]>>;
/**
* Zod schema for validating the data payload of an Arvo event.
* The data must be a JSON serializable object.
*/
export declare const ArvoDataSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodAny>, Record<string, any>, Record<string, any>>;
/**
* Zod schema for validating Arvo-specific extensions to the CloudEvent.
* This schema defines additional fields used by Arvo for event routing,
* access control, and execution metrics.
*/
export declare const ArvoExtensionSchema: z.ZodObject<{
to: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
accesscontrol: z.ZodNullable<z.ZodString>;
redirectto: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
executionunits: z.ZodNullable<z.ZodNumber>;
parentid: z.ZodNullable<z.ZodString>;
domain: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
to: string | null;
accesscontrol: string | null;
redirectto: string | null;
executionunits: number | null;
parentid: string | null;
domain: string | null;
}, {
to: string | null;
accesscontrol: string | null;
redirectto: string | null;
executionunits: number | null;
parentid: string | null;
domain: string | null;
}>;
/**
* Zod schema for validating OpenTelemetry extensions to the CloudEvent.
* This schema includes fields for distributed tracing as per the
* OpenTelemetry specification.
*/
export declare const OpenTelemetryExtensionSchema: z.ZodObject<{
traceparent: z.ZodNullable<z.ZodString>;
tracestate: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
traceparent: string | null;
tracestate: string | null;
}, {
traceparent: string | null;
tracestate: string | null;
}>;