UNPKG

@promptbook/browser

Version:

Promptbook: Run AI apps in plain human language across multiple models and platforms

41 lines (40 loc) 1.39 kB
import { type IDestroyable } from 'destroyable'; import type { string_name } from '../types/typeAliases'; import type { TODO_string } from './organization/TODO_string'; /** * Represents an entity in a global registry. * Contains identifying information about the package and class. */ export type Registered = { /** * The name of the package where the registered entity is defined. */ readonly packageName: TODO_string; /** * The name of the class being registered. */ readonly className: TODO_string; }; /** * Represents a registration record, including destroyable interface and registry name. */ export type Registration = Registered & IDestroyable & { /** * The name of the register this entity is registered in. */ readonly registerName: string_name; }; /** * Global registry for storing and managing registered entities of a given type. * * Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope. * * @private internal utility, exported are only singleton instances of this class */ export declare class $Register<TRegistered extends Registered> { private readonly registerName; private readonly storage; constructor(registerName: string_name); list(): ReadonlyArray<TRegistered>; register(registered: TRegistered): Registration; }