@glowlabs-org/events-sdk
Version:
Typed event SDK for Glow, powered by RabbitMQ and Zod.
27 lines (26 loc) • 1.02 kB
TypeScript
/**
* Validates that the zoneName matches the zoneId using the zoneMap.
* Throws an error if the values are inconsistent.
*/
export declare function validateZoneNameAndId(zoneId: number, zoneName: string): void;
/**
* Validates the event payload against the schema for the given eventType and schemaVersion.
* Throws an error if the schema does not exist or the payload is invalid.
*/
export declare function validateEventPayload(eventType: string, schemaVersion: "v1" | "v2", payload: any): void;
/**
* Processes a message object as the listener would, validating zone and schema.
* Throws if validation fails, returns the parsed event otherwise.
*/
export declare function processEventMessage(msg: {
content: Buffer;
fields: {
routingKey: string;
};
}): any;
export declare function validateName(name: string, type: "exchange" | "queue"): void;
export declare function buildAmqpUrl({ username, password, host, }: {
username: string;
password: string;
host: string;
}): string;