import { z } from 'zod'; import { DataEnvelope } from './data-envelope'; import { EventType } from './event-type'; import { IReference } from '../../references/types'; import { DirectedGraph } from 'graphology'; /** * The current specification version * of the cloud event. */ export declare const CLOUD_EVENT_SPEC_VERSION = "1.0"; /** * Properties required to construct * a cloud event. */ export declare const CloudEventSchema: z.ZodObject<{ /** * The cloud event specification version. * This version guarantees the structure * of the event. * @default 1.0 */ specversion: z.ZodDefault; /** * A unique identifier for the event. * @default a randomly generated UUID. */ id: z.ZodDefault; /** * The type of the event. * @see EventType */ type: z.ZodNativeEnum; /** * The time at which the event was created * in ISO 8601 format and UTC timezone. * @default the current time. */ time: z.ZodDefault; /** * The data envelope associated with the * cloud event. * @see DataEnvelope */ data: z.ZodEffects, DataEnvelope, unknown>; }, "strict", z.ZodTypeAny, { time: string; type: EventType; data: DataEnvelope; id: string; specversion: string; }, { type: EventType; time?: string | undefined; data?: unknown; id?: string | undefined; specversion?: string | undefined; }>; /** * The cloud event properties type. */ type CloudEventProps = z.infer; /** * Builder for the cloud event. */ declare class Builder { /** * The properties of the cloud event. */ private props; constructor(); /** * @param specversion the specification version of the * cloud event. * @returns the builder instance. */ withSpecVersion(specversion: string): this; /** * @param id the id of the cloud event. * @returns the builder instance. */ withId(id: string): this; /** * @param time the time the cloud event was created. * @returns the builder instance. */ withTime(time: string): this; /** * @param type the type associated with the event. * @returns the builder instance. */ withType(type: EventType): this; /** * @param data the data envelope associated * with the cloud event. * @returns the builder instance. */ withData(data: DataEnvelope): this; /** * @returns a new cloud event instance. */ build(): CloudEvent; } /** * A cloud event is a data structure that is at the core * of the events exchanged between middlewares. It contains * a description of the event received or emitted by a middleware, * information about the document associated with the event, * and all the metadata required by middlewares to make informed * decisions about how to process as document. * @note This data structure follows the official CloudEvents * specification (https://cloudevents.io/). */ export declare class CloudEvent { props: CloudEventProps; /** * The builder class for building a new * cloud event instance. */ static Builder: typeof Builder; constructor(props: CloudEventProps); /** * @param props the properties of the cloud event. * This can be either a JSON string or an object. * @returns a new cloud event instance constructed * from the given properties. * @throws an error if the properties are invalid. */ static from(props: string | object): CloudEvent; /** * @returns the data envelope object associated * with the cloud event. */ data(): DataEnvelope; /** * @returns the specification version of the * cloud event. */ specVersion(): string; /** * @returns the event unique identifier. */ id(): string; /** * @returns the type of the cloud event. */ type(): EventType; /** * @returns the time at which the cloud event * was created. */ time(): string; /** * @returns a new instance consisting of a deep copy of * values associated with the current cloud event. */ clone(): CloudEvent; /** * Allows to resolve a reference against the current * cloud event. * @param reference the reference to resolve. * @returns the value associated with the given reference. */ resolve(reference: IReference): Promise; /** * Describes how the document should be serialized. * @returns an object with the properties associated * with the JSON representation of the event. */ toJSON(): { specversion: string; id: string; type: EventType; time: string; data: { chainId: string; source: { url: string; type: string; size: number | undefined; etag: string | undefined; }; document: { url: string; type: string; size: number | undefined; etag: string | undefined; }; /** * Describes how the document should be serialized. * @returns an object with the properties associated * with the JSON representation of the event. */ metadata: { language?: string | undefined; custom?: Record | undefined; type?: string | undefined; description?: string | undefined; image?: string | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; authors?: string[] | undefined; publisher?: { name: string; url?: string | undefined; type?: string | undefined; logo?: string | undefined; } | undefined; title?: string | undefined; keywords?: string[] | undefined; topics?: string[] | undefined; rating?: number | undefined; ontology?: import("../../pointer").Pointer> | undefined; properties?: { kind: "image"; attrs: { custom?: Record | undefined; format?: string | undefined; text?: import("../../pointer").Pointer | undefined; faces?: import("../../pointer").Pointer | undefined; objects?: import("../../pointer").Pointer | undefined; labels?: import("../../pointer").Pointer | undefined; dimensions?: { width: number; height: number; } | undefined; dominantColor?: { blue: number; green: number; red: number; } | undefined; thumbnail?: string | undefined; orientation?: any; exif?: Record | undefined; geolocation?: { latitude: number; longitude: number; } | undefined; embeddings?: { vectors: import("../../pointer").Pointer; model: string; dimensions: number; } | undefined; ppe?: { personsWithRequiredEquipment: number; personsWithoutRequiredEquipment: number; personsIndeterminate: number; persons?: import("../../pointer").Pointer | undefined; } | undefined; stats?: { text?: number | undefined; faces?: number | undefined; objects?: number | undefined; labels?: number | undefined; moderations?: number | undefined; } | undefined; variance?: number | undefined; hashes?: { perceptual?: string | undefined; average?: string | undefined; median?: string | undefined; difference?: string | undefined; cropResistant?: string | undefined; wavelet?: string | undefined; color?: string | undefined; } | undefined; }; } | { kind: "text"; attrs: { custom?: Record | undefined; encoding?: "base64" | "ascii" | "utf-8" | "hex" | "utf-7" | "utf-7-imap" | "utf-16" | "utf16-le" | "utf16-be" | "utf32" | "utf32-le" | "utf32-be" | "iso-8859-1" | "iso-8859-2" | "iso-8859-3" | "iso-8859-4" | "iso-8859-5" | "iso-8859-6" | "iso-8859-7" | "iso-8859-8" | "iso-8859-9" | "iso-8859-10" | "iso-8859-11" | "iso-8859-12" | "iso-8859-13" | "iso-8859-14" | "iso-8859-15" | "iso-8859-16" | undefined; embeddings?: { vectors: import("../../pointer").Pointer; model: string; dimensions: number; } | undefined; stats?: { words?: number | undefined; sentences?: number | undefined; piis?: number | undefined; entities?: number | undefined; pos?: number | undefined; } | undefined; entities?: import("../../pointer").Pointer | undefined; pos?: import("../../pointer").Pointer | undefined; pages?: number | undefined; page?: number | undefined; chapters?: number | undefined; chapter?: number | undefined; layout?: { tableCount?: number | undefined; imageCount?: number | undefined; } | undefined; readingTime?: number | undefined; sentiment?: import("..").Sentiment | undefined; pii?: import("../../pointer").Pointer | undefined; chunk?: { id: string; order: number; total?: number | undefined; startOffset?: number | undefined; endOffset?: number | undefined; } | undefined; }; } | { kind: "video"; attrs: { custom?: Record | undefined; duration?: number | undefined; format?: string | undefined; thumbnail?: string | undefined; embeddings?: { vectors: import("../../pointer").Pointer; model: string; dimensions: number; } | undefined; codec?: string | undefined; resolution?: { width: number; height: number; } | undefined; fps?: number | undefined; aspectRatio?: number | undefined; audioTracks?: { custom?: Record | undefined; duration?: number | undefined; embeddings?: { vectors: import("../../pointer").Pointer; model: string; dimensions: number; } | undefined; codec?: string | undefined; bitrate?: number | undefined; sampleRate?: number | undefined; channels?: number | undefined; lossless?: boolean | undefined; }[] | undefined; scenes?: import("../../pointer").Pointer | undefined; }; } | { kind: "audio"; attrs: { custom?: Record | undefined; duration?: number | undefined; embeddings?: { vectors: import("../../pointer").Pointer; model: string; dimensions: number; } | undefined; codec?: string | undefined; bitrate?: number | undefined; sampleRate?: number | undefined; channels?: number | undefined; lossless?: boolean | undefined; }; } | undefined; }; callStack: string[]; }; }; /** * @returns a promise to a directed graph representation * of the ontology extracted from the cloud event. */ asGraph(): Promise; } export {};