Interface BridgeModule<TParams, TEventData>

interface BridgeModule<
    TParams extends BridgeParams = BridgeParams,
    TEventData extends BridgeModuleEventData = BridgeModuleEventData,
> {
    address: Lowercase<string>;
    config: TParams["config"];
    eventData: TEventData;
    id: string;
    modName?: string;
    params: TParams;
    previousHash: () => Promisable<undefined | string>;
    queries: string[];
    query: <
        T extends UnsignedQueryBoundWitness = UnsignedQueryBoundWitness,
        TConf extends
            DeepRestrictToStringKeys<
                {
                    allowedQueries?: string[];
                    archiving?: { archivists?: string[]; queries?: string[] };
                    archivist?: string;
                    consoleLogger?: LogLevel;
                    labels?: { [key: string]: undefined | string };
                    name?: string;
                    paging?: { [key: string]: { size?: number } };
                    retry?: { backoff?: number; interval?: number; retries?: number };
                    schema: "network.xyo.module.config";
                    security?: {
                        allowAnonymous?: boolean;
                        allowed?: {
                            [key: string]: (Lowercase<string> | Lowercase<(...)>[])[];
                        };
                        disallowed?: { [key: string]: Lowercase<string>[] };
                    };
                    sign?: boolean;
                    storeQueries?: boolean;
                    timestamp?: boolean;
                },
            > = DeepRestrictToStringKeys<
            {
                allowedQueries?: string[];
                archiving?: { archivists?: string[]; queries?: string[] };
                archivist?: string;
                consoleLogger?: LogLevel;
                labels?: { [key: string]: undefined | string };
                name?: string;
                paging?: { [key: string]: { size?: number } };
                retry?: { backoff?: number; interval?: number; retries?: number };
                schema: "network.xyo.module.config";
                security?: {
                    allowAnonymous?: boolean;
                    allowed?: { [key: string]: (Lowercase<string> | Lowercase<(...)>[])[] };
                    disallowed?: { [key: string]: Lowercase<string>[] };
                };
                sign?: boolean;
                storeQueries?: boolean;
                timestamp?: boolean;
            },
        >,
    >(
        query: T,
        payloads?: DeepRestrictToStringKeys<{ schema: string }>[],
        queryConfig?: TConf,
    ) => Promisable<
        ModuleQueryResult<
            DeepRestrictToStringKeys<{ schema: string }>,
            DeepRestrictToStringKeys<
                {
                    details?: | null
                    | string
                    | number
                    | boolean
                    | {
                        [key: string]: | null
                        | string
                        | number
                        | boolean
                        | (
                            { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }
                        )
                        | (
                            string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null
                        )[];
                    }
                    | (
                        | null
                        | string
                        | number
                        | boolean
                        | {
                            [key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null;
                        }
                        | (
                            (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[]
                        )
                    )[];
                    message?: string;
                    name?: string;
                    query?: Lowercase<string>;
                    schema: "network.xyo.error.module";
                },
            >,
            BoundWitness,
        >,
    >;
    queryable: <
        T extends UnsignedQueryBoundWitness = UnsignedQueryBoundWitness,
        TConf extends
            DeepRestrictToStringKeys<
                {
                    allowedQueries?: string[];
                    archiving?: { archivists?: string[]; queries?: string[] };
                    archivist?: string;
                    consoleLogger?: LogLevel;
                    labels?: { [key: string]: undefined | string };
                    name?: string;
                    paging?: { [key: string]: { size?: number } };
                    retry?: { backoff?: number; interval?: number; retries?: number };
                    schema: "network.xyo.module.config";
                    security?: {
                        allowAnonymous?: boolean;
                        allowed?: {
                            [key: string]: (Lowercase<string> | Lowercase<(...)>[])[];
                        };
                        disallowed?: { [key: string]: Lowercase<string>[] };
                    };
                    sign?: boolean;
                    storeQueries?: boolean;
                    timestamp?: boolean;
                },
            > = DeepRestrictToStringKeys<
            {
                allowedQueries?: string[];
                archiving?: { archivists?: string[]; queries?: string[] };
                archivist?: string;
                consoleLogger?: LogLevel;
                labels?: { [key: string]: undefined | string };
                name?: string;
                paging?: { [key: string]: { size?: number } };
                retry?: { backoff?: number; interval?: number; retries?: number };
                schema: "network.xyo.module.config";
                security?: {
                    allowAnonymous?: boolean;
                    allowed?: { [key: string]: (Lowercase<string> | Lowercase<(...)>[])[] };
                    disallowed?: { [key: string]: Lowercase<string>[] };
                };
                sign?: boolean;
                storeQueries?: boolean;
                timestamp?: boolean;
            },
        >,
    >(
        query: T,
        payloads?: DeepRestrictToStringKeys<{ schema: string }>[],
        queryConfig?: TConf,
    ) => Promisable<boolean>;
    start?: () => Promisable<boolean>;
    stop?: () => Promisable<boolean>;
    clearListeners(eventNames: keyof TEventData | (keyof TEventData)[]): void;
    emit<TEventName extends string | number | symbol>(
        eventName: TEventName,
        eventArgs: TEventData[TEventName],
    ): Promise<void>;
    emitSerial<TEventName extends string | number | symbol>(
        eventName: TEventName,
        eventArgs: TEventData[TEventName],
    ): Promise<void>;
    listenerCount(eventNames: keyof TEventData | (keyof TEventData)[]): number;
    off<TEventName extends string | number | symbol>(
        eventNames: TEventName | TEventName[],
        listener: EventListener<TEventData[TEventName]>,
    ): void;
    offAny(listener: Promise<void> | EventAnyListener<EventArgs>): void;
    on<TEventName extends string | number | symbol>(
        eventNames: TEventName | TEventName[],
        listener: EventListener<TEventData[TEventName]>,
    ): EventUnsubscribeFunction;
    onAny(listener: EventAnyListener<EventArgs>): EventUnsubscribeFunction;
    once<TEventName extends string | number | symbol>(
        eventName: TEventName,
        listener: EventListener<TEventData[TEventName]>,
    ): EventUnsubscribeFunction;
}

Type Parameters

Hierarchy (View Summary)

Properties

address: Lowercase<string>
config: TParams["config"]
eventData: TEventData
id: string
modName?: string
params: TParams
previousHash: () => Promisable<undefined | string>
queries: string[]
query: <
    T extends UnsignedQueryBoundWitness = UnsignedQueryBoundWitness,
    TConf extends
        DeepRestrictToStringKeys<
            {
                allowedQueries?: string[];
                archiving?: { archivists?: string[]; queries?: string[] };
                archivist?: string;
                consoleLogger?: LogLevel;
                labels?: { [key: string]: undefined | string };
                name?: string;
                paging?: { [key: string]: { size?: number } };
                retry?: { backoff?: number; interval?: number; retries?: number };
                schema: "network.xyo.module.config";
                security?: {
                    allowAnonymous?: boolean;
                    allowed?: { [key: string]: (Lowercase<string> | Lowercase<(...)>[])[] };
                    disallowed?: { [key: string]: Lowercase<string>[] };
                };
                sign?: boolean;
                storeQueries?: boolean;
                timestamp?: boolean;
            },
        > = DeepRestrictToStringKeys<
        {
            allowedQueries?: string[];
            archiving?: { archivists?: string[]; queries?: string[] };
            archivist?: string;
            consoleLogger?: LogLevel;
            labels?: { [key: string]: undefined | string };
            name?: string;
            paging?: { [key: string]: { size?: number } };
            retry?: { backoff?: number; interval?: number; retries?: number };
            schema: "network.xyo.module.config";
            security?: {
                allowAnonymous?: boolean;
                allowed?: { [key: string]: (Lowercase<string> | Lowercase<(...)>[])[] };
                disallowed?: { [key: string]: Lowercase<string>[] };
            };
            sign?: boolean;
            storeQueries?: boolean;
            timestamp?: boolean;
        },
    >,
>(
    query: T,
    payloads?: DeepRestrictToStringKeys<{ schema: string }>[],
    queryConfig?: TConf,
) => Promisable<
    ModuleQueryResult<
        DeepRestrictToStringKeys<{ schema: string }>,
        DeepRestrictToStringKeys<
            {
                details?: | null
                | string
                | number
                | boolean
                | {
                    [key: string]: | null
                    | string
                    | number
                    | boolean
                    | (
                        { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }
                    )
                    | (
                        string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null
                    )[];
                }
                | (
                    | null
                    | string
                    | number
                    | boolean
                    | {
                        [key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null;
                    }
                    | (
                        (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[]
                    )
                )[];
                message?: string;
                name?: string;
                query?: Lowercase<string>;
                schema: "network.xyo.error.module";
            },
        >,
        BoundWitness,
    >,
>
queryable: <
    T extends UnsignedQueryBoundWitness = UnsignedQueryBoundWitness,
    TConf extends
        DeepRestrictToStringKeys<
            {
                allowedQueries?: string[];
                archiving?: { archivists?: string[]; queries?: string[] };
                archivist?: string;
                consoleLogger?: LogLevel;
                labels?: { [key: string]: undefined | string };
                name?: string;
                paging?: { [key: string]: { size?: number } };
                retry?: { backoff?: number; interval?: number; retries?: number };
                schema: "network.xyo.module.config";
                security?: {
                    allowAnonymous?: boolean;
                    allowed?: { [key: string]: (Lowercase<string> | Lowercase<(...)>[])[] };
                    disallowed?: { [key: string]: Lowercase<string>[] };
                };
                sign?: boolean;
                storeQueries?: boolean;
                timestamp?: boolean;
            },
        > = DeepRestrictToStringKeys<
        {
            allowedQueries?: string[];
            archiving?: { archivists?: string[]; queries?: string[] };
            archivist?: string;
            consoleLogger?: LogLevel;
            labels?: { [key: string]: undefined | string };
            name?: string;
            paging?: { [key: string]: { size?: number } };
            retry?: { backoff?: number; interval?: number; retries?: number };
            schema: "network.xyo.module.config";
            security?: {
                allowAnonymous?: boolean;
                allowed?: { [key: string]: (Lowercase<string> | Lowercase<(...)>[])[] };
                disallowed?: { [key: string]: Lowercase<string>[] };
            };
            sign?: boolean;
            storeQueries?: boolean;
            timestamp?: boolean;
        },
    >,
>(
    query: T,
    payloads?: DeepRestrictToStringKeys<{ schema: string }>[],
    queryConfig?: TConf,
) => Promisable<boolean>
start?: () => Promisable<boolean>
stop?: () => Promisable<boolean>

Methods