@glowlabs-org/events-sdk
Version:
Typed event SDK for Glow, powered by RabbitMQ and Zod.
155 lines (154 loc) • 4.7 kB
TypeScript
import { z } from "zod";
import { EventType } from "./event-types";
export declare const baseEventZ: z.ZodObject<{
id: z.ZodString;
zoneId: z.ZodEffects<z.ZodNumber, number, number>;
zoneName: z.ZodEnum<[string, ...string[]]>;
schemaVersion: z.ZodEnum<["v1", "v2", "v2-alpha"]>;
eventType: z.ZodEnum<[EventType, ...EventType[]]>;
timeStamp: z.ZodNumber;
environment: z.ZodDefault<z.ZodEnum<["staging", "production"]>>;
}, "strip", z.ZodTypeAny, {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v1" | "v2" | "v2-alpha";
eventType: EventType;
timeStamp: number;
environment: "staging" | "production";
}, {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v1" | "v2" | "v2-alpha";
eventType: EventType;
timeStamp: number;
environment?: "staging" | "production" | undefined;
}>;
export interface BaseEventAuditPushedV1 {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v1";
eventType: "audit.pushed";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventAuditSlashedV1 {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v1";
eventType: "audit.slashed";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventAuditPfeesPaidV1 {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v1";
eventType: "audit.pfees.paid";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventAuditPfeesPaidV2 {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2";
eventType: "audit.pfees.paid";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventAuditPfeesPaidV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "audit.pfees.paid";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventApplicationCreatedV1 {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v1";
eventType: "application.created";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventApplicationCreatedV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "application.created";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventApplicationPriceQuoteV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "application.price.quote";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventGctlMintedV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "gctl.minted";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventAuditorFeesPaidV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "auditor.fees.paid";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventFractionCreatedV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "fraction.created";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventFractionSoldV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "fraction.sold";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventFractionClosedV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "fraction.closed";
timeStamp: number;
environment: "staging" | "production";
}
export interface BaseEventFractionRefundedV2Alpha {
id: string;
zoneId: number;
zoneName: string;
schemaVersion: "v2-alpha";
eventType: "fraction.refunded";
timeStamp: number;
environment: "staging" | "production";
}
export type BaseEvent = BaseEventAuditPushedV1 | BaseEventAuditSlashedV1 | BaseEventAuditPfeesPaidV1 | BaseEventAuditPfeesPaidV2 | BaseEventAuditPfeesPaidV2Alpha | BaseEventApplicationCreatedV1 | BaseEventApplicationCreatedV2Alpha | BaseEventApplicationPriceQuoteV2Alpha | BaseEventGctlMintedV2Alpha | BaseEventAuditorFeesPaidV2Alpha | BaseEventFractionCreatedV2Alpha | BaseEventFractionSoldV2Alpha | BaseEventFractionClosedV2Alpha | BaseEventFractionRefundedV2Alpha;