UNPKG

minauth

Version:

A TypeScript library for building authentication systems on top of the Mina blockchain and other zero-knowledge proofs solutions.

49 lines (48 loc) 2.33 kB
/// <reference types="passport" /> import { Configuration } from './config.js'; import { ReaderTaskEither } from 'fp-ts/lib/ReaderTaskEither.js'; import { PluginRuntime, PluginRuntimeEnv } from '../../server/pluginruntime.js'; import * as expressCore from 'express-serve-static-core'; import { Logger } from '../../plugin/logger.js'; /** * The data that is constantly available to the plugin server. */ export type PluginServerEnv = Readonly<{ config: Configuration; rootLogger: Logger; pluginRuntimeEnv: PluginRuntimeEnv; expressApp: expressCore.Express; }>; /** The plugin server monad. Actions are TaskEither's (fallible async calls) * that can read the PluginServerEnv. */ export type PluginServer<Ret> = ReaderTaskEither<PluginServerEnv, string, Ret>; /** Lift PluginRuntime action into PluginServer action. */ export declare const liftPluginRuntime: <Ret>(a: PluginRuntime<Ret>) => PluginServer<Ret>; /** Use the instance of the underlying root logger. */ export declare const useRootLogger: (f: (logger: Logger) => void) => PluginServer<void>; /** Get the underlying root logger of the plugin server. */ export declare const askRootLogger: () => PluginServer<Logger>; /** Get the underlying plugin runtime environment. */ export declare const askPluginRuntimeEnv: () => PluginServer<Readonly<{ logger: Logger; plugins: Readonly<Record<string, import("../../server/pluginruntime.js").RuntimePluginInstance>>; }>>; /** Use the instance of the underlying express app. */ export declare const useExpressApp: (f: (app: expressCore.Express) => void) => PluginServer<void>; /** Call an effectful (PluginServer monad) function on the underlying express app. */ export declare const withExpressApp: <Ret>(f: (app: expressCore.Express) => PluginServer<Ret>) => PluginServer<Ret>; /** Get the underlying express app from the plugin server environment. */ export declare const askExpressApp: () => PluginServer<expressCore.Express>; /** Get the plugin configuration from the plugin server environment. */ export declare const askConfig: () => PluginServer<{ plugins: Record<string, { path?: string | undefined; config?: unknown; }>; address: string; port: number; logLevel: number; logType: "json" | "pretty" | "hidden"; pluginDir?: string | undefined; }>;