openvibe-sdk/site

Generated at from openvibe-contracts v0.443.0 and openvibe-sdk v0.177.0.

From types/site.d.ts (server only). Declarations are shown verbatim.

interface KeyStoreConfig

A site's config: the flat shape or the nested one.

export interface KeyStoreConfig {
    networkInternalUrl?: string;
    networkUrl?: string;
    network?: { internalUrl?: string; url?: string };
    [key: string]: unknown;
}

interface KeyStoreOptions

export interface KeyStoreOptions {
    config: KeyStoreConfig;
    /** Log prefix, e.g. 'OpenVibe.Blog'. Default 'site'. */
    name?: string;
    fetchImpl?: typeof fetch;
    log?: Logger;
}

type VerifyResult

export type VerifyResult =
    | { ok: true; claims: Record<string, any> }
    | { ok: false; reason: string; code?: string; expired?: boolean };

interface KeyStore

export interface KeyStore {
    ensure(): Promise<void>;
    get(): string | null;
    loaded(): boolean;
    status: unknown;
    verifyUser(token: string, o?: { issuer?: string; audience?: string | string[]; now?: number | (() => number) }): Promise<VerifyResult>;
    verifyApp(token: string, o?: { issuer?: string; audience?: string | string[]; acceptSandbox?: boolean; now?: number | (() => number) }): Promise<VerifyResult>;
    pemForToken(token: string): Promise<string | null>;
    client: unknown;
}

export export const KEY_UNAVAILABLE: string;

export const KEY_UNAVAILABLE: string;

export export const DOES_NOT_VERIFY: string;

export const DOES_NOT_VERIFY: string;

export export function createKeyStore(o: KeyStoreOptions): KeyStore

export function createKeyStore(o: KeyStoreOptions): KeyStore;

export export function jwksUrl(config: KeyStoreConfig): string;

export function jwksUrl(config: KeyStoreConfig): string;

export export function publicReason(err: unknown): string;

export function publicReason(err: unknown): string;

export export const ASYNC_METHODS: string[];

export const ASYNC_METHODS: string[];

export export function wrapHandler<T>(h: T): T;

export function wrapHandler<T>(h: T): T;

export export function asyncRouter<R = any>(routerOrOptions: R | {

An Express Router (or { express } to make one) whose async handlers send a rejection to next(err).

export function asyncRouter<R = any>(routerOrOptions: R | { express: { Router(): R } }, o?: { methods?: string[] }): R;

export export function linksOf(html: string): string | null;

export function linksOf(html: string): string | null;

export export function linkHeader(): Middleware;

export function linkHeader(): Middleware;

interface OpenapiOptions

export interface OpenapiOptions {
    title: string;
    description?: string;
    version?: string | number;
    baseUrl: string;
    docs?: string;
    apiBase?: string;
    /** The API source files whose header comments name the routes ("GET /x   what it does"). */
    files?: string[];
}

export export const OPENAPI_METHODS: string[];

export const OPENAPI_METHODS: string[];

export export function openapiRoute(app: any, o: OpenapiOptions): (

export function openapiRoute(app: any, o: OpenapiOptions): (req: Req, res: Res) => void;

export export function routesOf(router: any, prefix?: string, out?:

export function routesOf(router: any, prefix?: string, out?: Array<{ method: string; path: string }>): Array<{ method: string; path: string }>;

export export function summariesFrom(files: string[], apiBase: stri

export function summariesFrom(files: string[], apiBase: string): Record<string, string>;

export export function mountPathOf(layer: any): string | null;

export function mountPathOf(layer: any): string | null;

export export const TIME_KEY: RegExp;

export const TIME_KEY: RegExp;

export export const SQL_TEXT_TIME: RegExp;

export const SQL_TEXT_TIME: RegExp;

export export function isoTime<T>(value: T): T | string;

export function isoTime<T>(value: T): T | string;

export export function normalizeTimes<T>(value: T, depth?: number):

export function normalizeTimes<T>(value: T, depth?: number): T;

export export function isoJsonTimes(req: Req, res: Res, next: Next)

export function isoJsonTimes(req: Req, res: Res, next: Next): void;

export export function storedTime(value: unknown): string | null;

export function storedTime(value: unknown): string | null;

interface TwinsOptions

export interface TwinsOptions {
    /** express itself (the SDK does not depend on it). */
    express?: any;
    /** openvibe-shared/agent-layer. */
    agentLayer?: { mount(router: any, o: any): void; linkHeaderTags(url: string, llms: string): { head: string; header: string } };
    /** The public pages that have twins. */
    paths: RegExp;
}

interface Twins

export interface Twins {
    mountTwins(app: any, o: { router: any; descriptor: unknown; baseUrl: string; llms?: string }): void;
    renderWithRouter(router: any, path: string, host: string): Promise<string | null>;
    mockReq(path: string, host: string): Req;
    mockRes(): Res;
    wantsTwin(req: Req): boolean;
    TWIN_PATH_RE: RegExp;
}

export export function createTwins(o: TwinsOptions): Twins;

export function createTwins(o: TwinsOptions): Twins;