@samveys/core

Container, inject(), providers, plugins, hooks, lifecycle, config, env, logger, errors, hashing and encryption

Version
1.0.3Nov 5, 2026
Install
pnpm add @samveys/core

This list was read from version 1.0.2; run pnpm sync to refresh it.

Import
import { config, createApp, createConfigRepository, createContainer, createEncrypter, createExtensionRegistry, … } from '@samveys/core'

Function (34)

config Function

Typed read of the current application's config. A wrong path is a compile error.

function config<P extends ConfigPath>(path: P): PathValue<Config, P>;

Exported from packages/core/src/config.ts

createApp Function

Creates an application. Nothing runs until `register()` (or `run()`) is called. Lifecycle: register → boot → start → ready → shutdown, each allowed once, in order (SVS_E026).

function createApp(options?: CreateAppOptions): Application;

Exported from packages/core/src/application.ts

createConfigRepository Function

Creates a read-only repository over a deep-merged, deeply frozen copy of `tree`.

function createConfigRepository(tree: Readonly<Record<string, unknown>>): ConfigRepository;

Exported from packages/core/src/config.ts

createContainer Function

Creates an empty dependency-injection container.

function createContainer(): Container;

Exported from packages/core/src/container.ts

createEncrypter Function

AES-256-GCM encrypter. Keys are `base64:<32 bytes>`; decrypt tries `key`, then each of `previousKeys`.

function createEncrypter(options: {

Exported from packages/core/src/crypto.ts

createExtensionRegistry Function

Creates the registry behind `extend.*`. `bind(owner)` returns a `Proxy` rather than an object with one method per point. Extension points are open: packages add their own through `declare module '@samveys/core'`, so core cannot list them at runtime, and any `extend.<point>(...)` call must be accepted.

function createExtensionRegistry(): ExtensionRegistry;

Exported from packages/core/src/extensions.ts

createHasher Function

Argon2id password hasher producing PHC strings; defaults follow the OWASP minimum.

function createHasher(options?: Partial<HashOptions>): Hasher;

Exported from packages/core/src/crypto.ts

createHookRegistry Function

Creates a hook registry. Listeners run sequentially, in registration order, and are awaited.

function createHookRegistry(): HookRegistry;

Exported from packages/core/src/hooks.ts

createLogger Function

Creates a JSON-lines logger: one object per line with `level`, `time`, `msg`, bindings and fields.

function createLogger(options?: LoggerOptions): Logger;

Exported from packages/core/src/logger.ts

createRequestContext Function

Creates a request context (and marks it request-bound for the captured-request warning).

function createRequestContext(init?: {

Exported from packages/core/src/context.ts

currentContext Function

The context of the request being handled, or `undefined` outside a request.

function currentContext(): RequestContext | undefined;

Exported from packages/core/src/context.ts

defineConfig Function

Identity helper that types `samveys.config.ts`.

function defineConfig(config: SamveysConfig): SamveysConfig;

Exported from packages/core/src/config.ts

defineEnv Function

Declares the env variables an app needs; pass the result to `loadEnv()` or `createApp({ env })`.

function defineEnv<const S extends EnvShape>(shape: S): EnvDefinition<S>;

Exported from packages/core/src/env.ts

definePlugin Function

Declares a plugin. Nothing is validated here: the config schema runs when the app registers the plugin, and a factory that is never listed in `samveys.config.ts` does nothing.

function definePlugin<Input = undefined, C = Input>(definition: PluginDefinition<Input, C>): PluginFactory<Input, C>;

Exported from packages/core/src/plugins.ts

defineProvider Function

Declares a provider: an app-level plugin that receives the `AppContext`.

function defineProvider(definition: ProviderDefinition): Provider;

Exported from packages/core/src/plugins.ts

deprecate Function

Emits the deprecation warning the first time it is called in this process; later calls do nothing. Returns true when a warning was emitted.

function deprecate(info: DeprecationInfo): boolean;

Exported from packages/core/src/deprecation.ts

deprecated Function

Wraps a function so its first call warns. `fn.name` and arity are kept for stack traces and introspection.

function deprecated<A extends unknown[], R>(info: DeprecationInfo, fn: (...args: A) => R): (...args: A) => R;

Exported from packages/core/src/deprecation.ts

env Function

Typed read of a validated env value from the environment loaded by the current application.

function env<K extends keyof EnvValues & string>(key: K): EnvValues[K];

Exported from packages/core/src/env.ts

explain Function

The `ERROR_CODES` entry for `svs explain <code>`, or `undefined` for an unknown code.

function explain(code: string): ErrorCodeInfo | undefined;

Exported from packages/core/src/errors.ts

inject Function

Resolves a service. Works in class field initializers while the container constructs a service, and anywhere inside `container.run()` (also across `await`).

function inject<K extends BindingKey>(key: K): ContainerBindings[K];

Exported from packages/core/src/container.ts

isSamveysError Function

True for errors created by the framework.

function isSamveysError(value: unknown): value is SamveysError;

Exported from packages/core/src/errors.ts

loadConfigDir Function

Imports every `config/*.ts` file of `rootDir` (sorted); each default export lands under the file's base name.

function loadConfigDir(rootDir: string): Promise<Tree>;

Exported from packages/core/src/config.ts

loadEnv Function

Reads `.env`, then `.env.[APP_ENV]` (later wins), lets the process environment win over both, and validates every key of the definition. All failures are reported in one SVS_E010.

function loadEnv<S extends EnvShape>(definition: EnvDefinition<S>, options: LoadEnvOptions): Readonly<InferEnv<S>>;

Exported from packages/core/src/env.ts

markRequestBound Function

Marks an object as living only for one request, so storing it on a singleton can be flagged.

function markRequestBound<T extends object>(value: T): T;

Exported from packages/core/src/context.ts

mergeConfig Function

Deep-merges config trees (later wins; arrays are replaced). Keys named `__proto__`, `constructor` or `prototype` are rejected with SVS_E011. The result is prototype-less.

function mergeConfig(...sources: readonly Readonly<Record<string, unknown>>[]): Tree;

Exported from packages/core/src/config.ts

pluginError Function

Wraps a failure of a plugin or provider stage as `SVS_E025`: `[name] <stage> failed: <cause>`.

function pluginError(name: string, stage: string, cause: unknown): SamveysError;

Exported from packages/core/src/errors.ts

redact Function

Returns a copy of `value` that is safe to log or print: sensitive keys (see the list above) and the dotted paths in `extraPaths` become `[REDACTED]`, URL passwords are masked, errors are serialized and cycles are cut. Pure: the input is never modified.

function redact(value: unknown, extraPaths?: readonly string[]): unknown;

Exported from packages/core/src/logger.ts

requireContext Function

Like `currentContext()` but throws SVS_E005 when no request is active.

function requireContext(): RequestContext;

Exported from packages/core/src/context.ts

resolvePluginOrder Function

Filters plugins by `env`, checks names, `requires.samveys` and `requires.plugins`, and returns them in load order: dependencies first, otherwise registration order. Every error starts with `[plugin-name] `.

function resolvePluginOrder(entries: readonly PluginEntry[], options: {

Exported from packages/core/src/plugins.ts

runWithContext Function

Runs `fn` with `ctx` as the current request context; it survives `await`, timers and queued work.

function runWithContext<R>(ctx: RequestContext, fn: () => R): R;

Exported from packages/core/src/context.ts

satisfiesRange Function

True when `version` is inside `range`. Supports `^x.y(.z)`, `~x.y(.z)`, `>=x.y.z`, `x.y.z`, `x.x`, `*`, and space-separated AND. Returns `undefined` when the range cannot be parsed.

function satisfiesRange(version: string, range: string): boolean | undefined;

Exported from packages/core/src/plugins.ts

toProblemDetails Function

Problem Details for any thrown value. Unknown errors become a 500 `SVS_E049`; their message is included only when `debug` is true.

function toProblemDetails(error: unknown, options?: {

Exported from packages/core/src/errors.ts

traceAsync Function

Runs `fn` inside a tracing span: subscribers receive `start`, `end`, `asyncStart`, `asyncEnd` and `error` (on rejection). With no subscriber, `fn` runs untouched.

function traceAsync<T>(channelName: TracingChannelName, context: object, fn: () => Promise<T>): Promise<T>;

Exported from packages/core/src/tracing.ts

warnIfCaptured Function

logs one warning (outside production) when `value`, or one of its own fields, is a request-bound object held by the singleton `owner`. Returns true when it warned.

function warnIfCaptured(owner: string, value: unknown, logger: Logger, options?: {

Exported from packages/core/src/context.ts

Value (11)

ConfigToken Value

No documentation comment.

const ConfigToken: InjectionToken<ConfigRepository>;

Exported from packages/core/src/application.ts

EncrypterToken Value

No documentation comment.

const EncrypterToken: InjectionToken<Encrypter>;

Exported from packages/core/src/application.ts

Env Value

Rule builders for `defineEnv()`. A rule with `optional: true` types as `T | undefined`.

const Env: {
    string: typeof stringRule;
    number: typeof numberRule;
    boolean: typeof booleanRule;
    url: typeof urlRule;
    /** A string that never appears in error messages or `svs env:check` output. */
    secret: typeof secretRule;
    enum: typeof enumRule;
};

Exported from packages/core/src/env.ts

ERROR_CODES Value

No documentation comment.

const ERROR_CODES: {
    readonly SVS_E001: {
        readonly title: 'Dependency cycle';
        readonly status: 500;
        readonly description: 'The container found a dependency cycle while resolving a service. The message shows the full path, e.g. A → B → C → A.';
        readonly fix: 'Break the cycle: move the shared logic into a third service, or resolve one side lazily inside a method instead of a field. There is no forwardRef().';
    };
    readonly SVS_E002: {
        readonly title: 'Captive dependency';
        readonly status: 500;
  …
Show the whole declaration (60 lines)
const ERROR_CODES: {
    readonly SVS_E001: {
        readonly title: 'Dependency cycle';
        readonly status: 500;
        readonly description: 'The container found a dependency cycle while resolving a service. The message shows the full path, e.g. A → B → C → A.';
        readonly fix: 'Break the cycle: move the shared logic into a third service, or resolve one side lazily inside a method instead of a field. There is no forwardRef().';
    };
    readonly SVS_E002: {
        readonly title: 'Captive dependency';
        readonly status: 500;
        readonly description: 'A singleton holds a transient service that has dispose() or [Symbol.asyncDispose]; the transient would live as long as the singleton and never be disposed on time.';
        readonly fix: 'Make the dependency a singleton, or create it inside the method that uses it and dispose it there.';
    };
    readonly SVS_E003: {
        readonly title: 'Unresolvable service';
        readonly status: 500;
        readonly description: 'The container has no binding for the requested token and cannot construct it (abstract class, InjectionToken, binding key, or a constructor that needs arguments).';
        readonly fix: 'Register a binding with container.singleton(), container.transient() or container.instance() in a provider or plugin register().';
    };
    readonly SVS_E004: {
        readonly title: 'Resolve during register';
        readonly status: 500;
        readonly description: 'A service was resolved while providers and plugins were still registering, before every binding existed.';
        readonly fix: 'Only bind services in register(); resolve them in boot() or later.';
    };
    readonly SVS_E005: {
        readonly title: 'inject() outside a container context';
        readonly status: 500;
        readonly description: 'inject() was called outside a class field initializer resolved by the container and outside a request or container.run() scope.';
        readonly fix: 'Call inject() in a field of a class resolved by the container, in a route handler, or wrap the call in container.run().';
    };
    readonly SVS_E010: {
        readonly title: 'Invalid environment';
        readonly status: 500;
        readonly description: 'One or more environment variables are missing or malformed. Every failing variable is listed.';
        readonly fix: 'Fix the listed variables in .env, .env.[APP_ENV] or the process environment; see start/env.ts for the rules.';
    };
    readonly SVS_E011: {
        readonly title: 'Invalid config';
        readonly status: 500;
        readonly description: 'A config file exports a forbidden key (__proto__, constructor, prototype) or a value that cannot be merged.';
        readonly fix: 'Rename the key; config objects must be plain data.';
    };
    readonly SVS_E020: {
        readonly title: 'Missing required plugin';
        readonly status: 500;
        readonly description: 'A plugin lists another plugin in requires.plugins that is not registered in samveys.config.ts for this environment.';
        readonly fix: 'Install the missing plugin with `svs add <name>` or register it in samveys.config.ts.';
    };
    readonly SVS_E021: {
        readonly title: 'Plugin dependency cycle';
        readonly status: 500;
        readonly description: 'Plugins require each other in a cycle, so no load order exists.';
        readonly fix: 'Remove one of the requires.plugins entries in the cycle shown in the message.';
    };
    readonly SVS_E022: {
        readonly title: 'Incompatible Samveys version';
        readonly status: 500;
    // … 405 more lines
}

Exported from packages/core/src/contracts.ts

EventsToken Value

No documentation comment.

const EventsToken: InjectionToken<Emitter>;

Exported from packages/core/src/application.ts

HasherToken Value

No documentation comment.

const HasherToken: InjectionToken<Hasher>;

Exported from packages/core/src/application.ts

HooksToken Value

No documentation comment.

const HooksToken: InjectionToken<HookRegistry>;

Exported from packages/core/src/application.ts

LoggerToken Value

Container tokens for the services bound by core.

const LoggerToken: InjectionToken<Logger>;

Exported from packages/core/src/application.ts

SAMVEYS_API_VERSION Value

Version of the plugin API checked against `requires.samveys` (covered by the compatibility promise).

const SAMVEYS_API_VERSION = "1.0.0";

Exported from packages/core/src/contracts.ts

TRACING_CHANNELS Value

Names of the `node:diagnostics_channel` TracingChannels published by Samveys.

const TRACING_CHANNELS: {
    readonly httpRequest: 'samveys:http.request';
    readonly dbQuery: 'samveys:db.query';
    readonly viewRender: 'samveys:view.render';
    readonly jobProcess: 'samveys:job.process';
    readonly commandRun: 'samveys:command.run';
};

Exported from packages/core/src/contracts.ts

tracingChannels Value

The `TracingChannel`s published by Samveys. APM tools can subscribe through `node:diagnostics_channel` alone, without importing Samveys.

const tracingChannels: {
    readonly [K in keyof typeof TRACING_CHANNELS]: TracingChannel;
};

Exported from packages/core/src/tracing.ts

Class (3)

EventEmitter Class

Typed in-process event emitter. Listeners run sequentially and are awaited.

class EventEmitter implements Emitter {
    #private;
    on<K extends EventName>(event: K, listener: EventListener<K>): Unsubscribe;
    once<K extends EventName>(event: K, listener: EventListener<K>): Unsubscribe;
    off<K extends EventName>(event: K, listener: EventListener<K>): void;
    /** Calls every listener in order; rejects with the first error only after all of them ran. */
    emit<K extends EventName>(event: K, payload: Events[K]): Promise<void>;
    listenerCount(event: EventName): number;
    clear(event?: EventName): void;
}

Exported from packages/core/src/events.ts

InjectionToken Class

A token for interfaces and values that have no class.

class InjectionToken<T> implements InjectionTokenLike<T> {
    readonly description: string;
    /** Phantom; never set at runtime. */
    readonly __type?: T;
    constructor(description: string);
    toString(): string;
}

Exported from packages/core/src/container.ts

SamveysError Class

Every error thrown by the framework. Carries a stable `SVS_E*` code from `ERROR_CODES`.

class SamveysError extends Error {
    readonly code: ErrorCode;
    readonly status: number;
    readonly issues: readonly ValidationIssue[];
    readonly meta: Readonly<Record<string, unknown>>;
    readonly expose: boolean;
    constructor(code: ErrorCode, message: string, options?: SamveysErrorOptions);
    /** RFC 9457 Problem Details. `detail` is included only when it is safe to show a client. */
    toProblem(requestId?: string): ProblemDetails;
}

Exported from packages/core/src/errors.ts

Interface (65)

AppContext Interface

What providers receive, and what `svs` commands see.

interface AppContext extends AppInfo {
    readonly container: Container;
    readonly hooks: HookRegistry;
    readonly config: ConfigRepository;
    readonly logger: Logger;
    readonly events: Emitter;
    readonly extensions: ExtensionRegistry;
    readonly state: AppState;
    readonly plugins: readonly LoadedPluginInfo[];
}

Exported from packages/core/src/contracts.ts

AppInfo Interface

No documentation comment.

interface AppInfo {
    readonly name: string;
    readonly env: AppEnvironment;
    readonly debug: boolean;
    readonly rootDir: string;
    readonly apiVersion: string;
}

Exported from packages/core/src/contracts.ts

Application Interface

No documentation comment.

interface Application extends AppContext {
    /** created → registered. Validates plugins (SVS_E020..24), env and runs every register(). */
    register(): Promise<void>;
    /** registered → booted. Emits app:booting, runs boot(), validates the container graph, emits app:booted. */
    boot(): Promise<void>;
    /** booted → started. */
    start(): Promise<void>;
    /** started → ready. Emits app:ready. */
    ready(): Promise<void>;
    /** register → boot → start → ready, skipping stages already done. */
  …
Show the whole declaration (19 lines)
interface Application extends AppContext {
    /** created → registered. Validates plugins (SVS_E020..24), env and runs every register(). */
    register(): Promise<void>;
    /** registered → booted. Emits app:booting, runs boot(), validates the container graph, emits app:booted. */
    boot(): Promise<void>;
    /** booted → started. */
    start(): Promise<void>;
    /** started → ready. Emits app:ready. */
    ready(): Promise<void>;
    /** register → boot → start → ready, skipping stages already done. */
    run(): Promise<void>;
    /** Emits app:terminating, runs shutdown() in reverse order with the timeout, disposes the container. */
    shutdown(reason?: string): Promise<ShutdownResult>;
    /** Install SIGTERM/SIGINT handlers that call shutdown() and then exit with its code. */
    handleSignals(options?: {
        readonly signals?: readonly NodeJS.Signals[];
        readonly exit?: boolean;
    }): Unsubscribe;
}

Exported from packages/core/src/contracts.ts

BindingInfo Interface

No documentation comment.

interface BindingInfo {
    readonly token: string;
    readonly lifetime: Lifetime;
    /** Plugin or provider that registered it; `undefined` for implicit singletons and core bindings. */
    readonly owner: string | undefined;
    readonly swapped: boolean;
}

Exported from packages/core/src/contracts.ts

BooleanOptions Interface

No documentation comment.

interface BooleanOptions {
    readonly default?: boolean;
}

Exported from packages/core/src/env.ts

CheckContext Interface

No documentation comment.

interface CheckContext {
    readonly app: AppContext;
    /** `svs check --deploy`. */
    readonly deploy: boolean;
}

Exported from packages/core/src/contracts.ts

CommandInvocation Interface

What a command emits to `command:before` / `command:after`.

interface CommandInvocation {
    readonly name: string;
    readonly argv: readonly string[];
}

Exported from packages/core/src/contracts.ts

CommandLike Interface

Minimal command shape known to core; `@samveys/console` commands satisfy it.

interface CommandLike {
    readonly name: string;
    readonly description: string;
}

Exported from packages/core/src/contracts.ts

Config Interface

The app config tree; augment to type `config('path')`.

interface Config {
}

Exported from packages/core/src/contracts.ts

ConfigRepository Interface

No documentation comment.

interface ConfigRepository {
    /** Typed read. A wrong path is a compile error. */
    get<P extends ConfigPath>(path: P): PathValue<Config, P>;
    /** Untyped read for code that cannot see the app's `Config` augmentation (plugins). */
    raw(path: string): unknown;
    has(path: string): boolean;
    /** Deeply frozen, prototype-less copy of the whole tree. */
    all(): Readonly<Record<string, unknown>>;
}

Exported from packages/core/src/contracts.ts

Container Interface

No documentation comment.

interface Container {
    /** Bind a shared instance, created on first resolve. Without a factory, `new Token()` is used. */
    singleton<K extends BindingKey>(key: K, factory: Factory<ContainerBindings[K]>): this;
    singleton<T>(token: Token<T>, factory?: Factory<T>): this;
    /** Bind a service created on every resolve. */
    transient<K extends BindingKey>(key: K, factory: Factory<ContainerBindings[K]>): this;
    transient<T>(token: Token<T>, factory?: Factory<T>): this;
    /** Bind an existing value. Never disposed by the container. */
    instance<K extends BindingKey>(key: K, value: ContainerBindings[K]): this;
    instance<T>(token: Token<T>, value: T): this;
  …
Show the whole declaration (20 lines)
interface Container {
    /** Bind a shared instance, created on first resolve. Without a factory, `new Token()` is used. */
    singleton<K extends BindingKey>(key: K, factory: Factory<ContainerBindings[K]>): this;
    singleton<T>(token: Token<T>, factory?: Factory<T>): this;
    /** Bind a service created on every resolve. */
    transient<K extends BindingKey>(key: K, factory: Factory<ContainerBindings[K]>): this;
    transient<T>(token: Token<T>, factory?: Factory<T>): this;
    /** Bind an existing value. Never disposed by the container. */
    instance<K extends BindingKey>(key: K, value: ContainerBindings[K]): this;
    instance<T>(token: Token<T>, value: T): this;
    /** Replace a binding (tests). Drops a cached instance; keeps the original lifetime. */
    swap<K extends BindingKey>(key: K, factory: Factory<ContainerBindings[K]>): this;
    swap<T>(token: Token<T>, factory: Factory<T>): this;
    /** Undo `swap()` for one token, or for all when called without arguments. */
    restore(token?: AnyToken): this;
    make<K extends BindingKey>(key: K): ContainerBindings[K];
    make<T>(token: Token<T>): T;
    has(token: AnyToken): boolean;
    /** Run `fn` with this container as the `inject()` context (also across `await`). */
    run<R>(fn: () => R): R;

Exported from packages/core/src/contracts.ts

ContainerBindings Interface

String-keyed bindings; augment to type `container.make('key')` and `inject('key')`.

interface ContainerBindings {
}

Exported from packages/core/src/contracts.ts

CreateAppOptions Interface

No documentation comment.

interface CreateAppOptions extends SamveysConfig {
    readonly rootDir?: string;
    /** Defaults to env APP_ENV, then `NODE_ENV === 'production' ? 'production' : 'local'`. */
    readonly environment?: AppEnvironment;
    /** Defaults to env APP_DEBUG, then `environment !== 'production'`. */
    readonly debug?: boolean;
    readonly processEnv?: Readonly<Record<string, string | undefined>>;
    /** A ready logger replaces `logger` options (tests). */
    readonly loggerInstance?: Logger;
    /** Load `config/*.ts` from rootDir. Default true when rootDir is given. */
    readonly loadConfigDir?: boolean;
}

Exported from packages/core/src/contracts.ts

DeprecationInfo Interface

A registered deprecation: what replaces the API and when it goes away.

interface DeprecationInfo {
    /** `SVS_DEP001`, `SVS_DEP002`, … Never reused. */
    readonly code: `SVS_DEP${number}`;
    /** What is deprecated and what to use instead. */
    readonly message: string;
    /** The major version that removes it, e.g. `2.0.0`. */
    readonly removedIn: string;
}

Exported from packages/core/src/deprecation.ts

Emitter Interface

No documentation comment.

interface Emitter {
    on<K extends EventName>(event: K, listener: EventListener<K>): Unsubscribe;
    once<K extends EventName>(event: K, listener: EventListener<K>): Unsubscribe;
    off<K extends EventName>(event: K, listener: EventListener<K>): void;
    /** Calls listeners sequentially and awaits each; rejects with the first error after all ran. */
    emit<K extends EventName>(event: K, payload: Events[K]): Promise<void>;
    listenerCount(event: EventName): number;
    clear(event?: EventName): void;
}

Exported from packages/core/src/contracts.ts

Encrypter Interface

No documentation comment.

interface Encrypter {
    /** AES-256-GCM with APP_KEY; `purpose` is bound as additional authenticated data. */
    encrypt(value: string | Uint8Array, purpose?: string): string;
    /** Tries APP_KEY, then each APP_PREVIOUS_KEYS entry; throws SVS_E030. */
    decrypt(payload: string, purpose?: string): string;
    decryptBytes(payload: string, purpose?: string): Uint8Array;
}

Exported from packages/core/src/contracts.ts

EnvDefinition Interface

No documentation comment.

interface EnvDefinition<S extends EnvShape = EnvShape> {
    readonly shape: S;
}

Exported from packages/core/src/contracts.ts

EnvIssue Interface

No documentation comment.

interface EnvIssue {
    readonly key: string;
    readonly message: string;
}

Exported from packages/core/src/contracts.ts

EnvRule Interface

No documentation comment.

interface EnvRule<T> {
    readonly kind: string;
    /** Secret values are never printed by `svs env:check` or error messages. */
    readonly secret: boolean;
    parse(raw: string | undefined, key: string): EnvParseResult<T>;
}

Exported from packages/core/src/contracts.ts

EnvValues Interface

Validated env values; augment with `InferEnv<typeof envDefinition>` to type `env('KEY')`.

interface EnvValues {
}

Exported from packages/core/src/contracts.ts

ErrorCodeInfo Interface

No documentation comment.

interface ErrorCodeInfo {
    /** Stable, short summary; used as the Problem Details `title`. */
    readonly title: string;
    /** HTTP status used when the error reaches an HTTP response. */
    readonly status: number;
    /** What happened. */
    readonly description: string;
    /** How to fix it. */
    readonly fix: string;
}

Exported from packages/core/src/contracts.ts

Events Interface

Event name → payload. Augment to add app events; an unknown name is a `tsc` error.

interface Events {
}

Exported from packages/core/src/contracts.ts

ExtensionEntry Interface

No documentation comment.

interface ExtensionEntry<K extends ExtensionPoint> {
    readonly owner: string;
    readonly args: ExtensionArgs<K>;
}

Exported from packages/core/src/contracts.ts

ExtensionPoints Interface

Extension point name → registration arguments. Core declares the points it owns; `@samveys/http` adds `middleware`, `router`, `validator`, `httpDriver`, and later packages add `dbDriver`, `cacheStore`, `queueDriver`, `mailTransport`, `storageDisk`, `template`.

interface ExtensionPoints {
    /** `extend.context('audit', ctx => audit)` → `ctx.audit`. Evaluated once per request, lazily. */

Exported from packages/core/src/contracts.ts

ExtensionRegistry Interface

No documentation comment.

interface ExtensionRegistry {
    add<K extends ExtensionPoint>(point: K, owner: string, ...args: ExtensionArgs<K>): void;
    get<K extends ExtensionPoint>(point: K): readonly ExtensionEntry<K>[];
    /** `extend.*` bound to one owner. */
    bind(owner: string): Extend;
}

Exported from packages/core/src/contracts.ts

GeneratorLike Interface

No documentation comment.

interface GeneratorLike {
    readonly name: string;
    readonly description: string;
}

Exported from packages/core/src/contracts.ts

Hasher Interface

No documentation comment.

interface Hasher {
    /** Argon2id via `crypto.argon2`, returned as a PHC string. */
    make(password: string): Promise<string>;
    /** Constant-time comparison. */
    verify(hash: string, password: string): Promise<boolean>;
    needsRehash(hash: string): boolean;
    /** `verify`, then rehash when parameters changed (used on login). */
    verifyAndRehash(hash: string, password: string): Promise<VerifyResult>;
}

Exported from packages/core/src/contracts.ts

HashOptions Interface

No documentation comment.

interface HashOptions {
    /** KiB. Default 19456 (OWASP Argon2id minimum). */
    readonly memory: number;
    /** Default 2. */
    readonly passes: number;
    /** Default 1. */
    readonly parallelism: number;
    /** Bytes. Default 32. */
    readonly tagLength: number;
}

Exported from packages/core/src/contracts.ts

HealthCheck Interface

No documentation comment.

interface HealthCheck {
    readonly name: string;
    run(signal: AbortSignal): Promise<{
        readonly status: HealthStatus;
        readonly detail?: string;
    }>;
}

Exported from packages/core/src/contracts.ts

HookEmitter Interface

Emits hooks. All listeners run sequentially in registration order and are awaited.

interface HookEmitter {
    /** Run every `on` listener; return values are ignored. */
    emit<K extends HookName>(name: K, ...args: HookArgs<K>): Promise<void>;
    /** Pass the first argument through every `filter` listener and return the final value. */
    applyFilters<K extends HookName>(name: K, ...args: HookArgs<K>): Promise<HookValue<K>>;
    /** Run `intercept` listeners until one returns a value other than `undefined`. */
    runInterceptors<K extends HookName>(name: K, ...args: HookArgs<K>): Promise<HookResult<K> | undefined>;
}

Exported from packages/core/src/contracts.ts

HookListenerInfo Interface

No documentation comment.

interface HookListenerInfo {
    readonly hook: string;
    readonly kind: HookKind;
    /** Plugin or provider that attached it; `undefined` for app code. */
    readonly owner: string | undefined;
}

Exported from packages/core/src/contracts.ts

HookRegistry Interface

No documentation comment.

interface HookRegistry extends HookEmitter {
    on<K extends HookName>(name: K, listener: HookListener<K>): Unsubscribe;
    filter<K extends HookName>(name: K, listener: HookFilter<K>): Unsubscribe;
    intercept<K extends HookName>(name: K, listener: HookInterceptor<K>): Unsubscribe;
    listeners(name?: HookName): readonly HookListenerInfo[];
    /**
     * An emitter that only reaches listeners whose owner passes `allow`. Used for plugins
     * limited to a route group: listeners of route-scoped plugins fire only
     * for routes in groups that list them.
     */
    scoped(allow: (owner: string | undefined) => boolean): HookEmitter;

Exported from packages/core/src/contracts.ts

HookResults Interface

Hook name → value an `intercept` listener may return to short-circuit the flow.

interface HookResults {
}

Exported from packages/core/src/contracts.ts

Hooks Interface

Hook name → argument tuple. For `filter` hooks the first argument is the filtered value. Augmented by `@samveys/http` (http:*), and by future packages (db:*, view:*, job:*, ws:*, …).

interface Hooks {
    'app:booting': [app: AppContext];
    'app:booted': [app: AppContext];
    'app:ready': [app: AppContext];
    'app:terminating': [app: AppContext, reason: string];
    'command:before': [command: CommandInvocation];
    'command:after': [command: CommandInvocation, exitCode: number];
}

Exported from packages/core/src/contracts.ts

HttpContext Interface

The HTTP request context. Base fields live in core so plugins can augment it with `declare module '@samveys/core' { interface HttpContext { audit: AuditLog } }`.

interface HttpContext {
    readonly request: Request;
    readonly url: URL;
    readonly method: string;
    readonly headers: Headers;
    /** Prototype-less. Narrowed per route by `@samveys/http`. */
    readonly params: Readonly<Record<string, string>>;
    readonly query: Readonly<Record<string, string | string[]>>;
    readonly body: unknown;
    /** Aborted on client disconnect or request timeout. */
  …
Show the whole declaration (22 lines)
interface HttpContext {
    readonly request: Request;
    readonly url: URL;
    readonly method: string;
    readonly headers: Headers;
    /** Prototype-less. Narrowed per route by `@samveys/http`. */
    readonly params: Readonly<Record<string, string>>;
    readonly query: Readonly<Record<string, string | string[]>>;
    readonly body: unknown;
    /** Aborted on client disconnect or request timeout. */
    readonly signal: AbortSignal;
    readonly requestId: string;
    readonly route: RouteInfo | undefined;
    /**
     * The client address: the socket peer, or the first `X-Forwarded-For` hop when the peer is a
     * trusted proxy (`trustProxy`). `undefined` for in-process requests (`kernel.fetch`). Use it for
     * rate limits and audit logs; never trust `X-Forwarded-For` yourself.
     */
    readonly clientIp: string | undefined;
    /** Prototype-less scratch space for middleware. */
    readonly state: Record<string, unknown>;
}

Exported from packages/core/src/contracts.ts

InjectionTokenLike Interface

A token that is not a class: use for interfaces and values. Implemented in `container.ts`.

interface InjectionTokenLike<T> {
    readonly description: string;
    /** Phantom; never set at runtime. */
    readonly __type?: T;
}

Exported from packages/core/src/contracts.ts

LifecycleHooks Interface

No documentation comment.

interface LifecycleHooks<Ctx> {
    /** Bind services only; resolving throws SVS_E004. */
    register?(context: Ctx): void;
    boot?(context: Ctx): void | Promise<void>;
    start?(context: Ctx): void | Promise<void>;
    ready?(context: Ctx): void | Promise<void>;
    /** Runs in reverse load order, each with a timeout. */
    shutdown?(context: Ctx): void | Promise<void>;
}

Exported from packages/core/src/contracts.ts

LoadedPluginInfo Interface

No documentation comment.

interface LoadedPluginInfo {
    readonly name: string;
    readonly kind: 'plugin' | 'provider';
    readonly order: number;
    readonly scope: PluginScope;
    readonly requires: readonly string[];
    readonly hooks: readonly HookListenerInfo[];
    readonly extensions: readonly {
        readonly point: string;
        readonly detail: string;
  …
Show the whole declaration (13 lines)
interface LoadedPluginInfo {
    readonly name: string;
    readonly kind: 'plugin' | 'provider';
    readonly order: number;
    readonly scope: PluginScope;
    readonly requires: readonly string[];
    readonly hooks: readonly HookListenerInfo[];
    readonly extensions: readonly {
        readonly point: string;
        readonly detail: string;
    }[];
    readonly bindings: readonly string[];
}

Exported from packages/core/src/contracts.ts

LoadEnvOptions Interface

No documentation comment.

interface LoadEnvOptions {
    /** Directory holding `.env` and `.env.[APP_ENV]`. */
    readonly rootDir: string;
    /** Defaults to `processEnv.APP_ENV`, then `'local'`. */
    readonly appEnv?: string;
    /** Defaults to `process.env`. Real environment variables win over files. */
    readonly processEnv?: Readonly<Record<string, string | undefined>>;
    /** Read `.env` files. Default true. */
    readonly files?: boolean;
}

Exported from packages/core/src/contracts.ts

LogDestination Interface

No documentation comment.

interface LogDestination {
    write(line: string): void;
}

Exported from packages/core/src/contracts.ts

LogFn Interface

No documentation comment.

interface LogFn {
    (message: string, fields?: Readonly<Record<string, unknown>>): void;
    (fields: Readonly<Record<string, unknown>>, message?: string): void;
}

Exported from packages/core/src/contracts.ts

Logger Interface

No documentation comment.

interface Logger {
    readonly level: LogLevel | 'silent';
    readonly trace: LogFn;
    readonly debug: LogFn;
    readonly info: LogFn;
    readonly warn: LogFn;
    readonly error: LogFn;
    readonly fatal: LogFn;
    isLevelEnabled(level: LogLevel): boolean;
    child(bindings: Readonly<Record<string, unknown>>): Logger;
}

Exported from packages/core/src/contracts.ts

LoggerOptions Interface

No documentation comment.

interface LoggerOptions {
    readonly level?: LogLevel | 'silent';
    /**
     * Extra paths to redact. A bare key (`password`) is redacted at any depth, case-insensitively;
     * a dotted path (`user.ssn`) only at that path. Defaults always apply (see logger.ts).
     */
    readonly redact?: readonly string[];
    /** Defaults to `process.stdout`. One JSON object per line. */
    readonly destination?: LogDestination;
    readonly bindings?: Readonly<Record<string, unknown>>;
}

Exported from packages/core/src/contracts.ts

NumberOptions Interface

No documentation comment.

interface NumberOptions {
    readonly default?: number;
    readonly optional?: boolean;
    readonly min?: number;
    readonly max?: number;
    readonly int?: boolean;
}

Exported from packages/core/src/env.ts

Plugin Interface

No documentation comment.

interface Plugin<C = unknown> {
    readonly kind: 'plugin';
    readonly name: string;
    readonly requires: Required<PluginRequirements>;
    readonly definition: PluginDefinition<unknown, C>;
    /** Raw options given to the factory; validated at register time (SVS_E024). */
    readonly options: unknown;
}

Exported from packages/core/src/contracts.ts

PluginContext Interface

Everything a plugin may touch. Never framework internals.

interface PluginContext<C = unknown> {
    readonly container: Container;
    readonly hooks: HookRegistry;
    readonly extend: Extend;
    /** Parsed by the plugin's config schema. */
    readonly config: C;
    /** Child logger whose lines carry `plugin: <name>`. */
    readonly logger: Logger;
    readonly app: AppInfo;
}

Exported from packages/core/src/contracts.ts

PluginDefinition Interface

No documentation comment.

interface PluginDefinition<Input = undefined, C = Input> extends LifecycleHooks<PluginContext<C>> {
    readonly name: string;
    readonly requires?: PluginRequirements;
    /** Validates the options passed to the factory; its output becomes `context.config`. */
    readonly config?: StandardSchemaV1<Input, C>;
}

Exported from packages/core/src/contracts.ts

PluginEntryOptions Interface

No documentation comment.

interface PluginEntryOptions {
    readonly plugin: Plugin;
    /** Load only in these environments. */
    readonly env?: readonly AppEnvironment[];
    /** `'routes'`: hooks fire only for route groups that list the plugin. Default `'global'`. */
    readonly scope?: PluginScope;
}

Exported from packages/core/src/contracts.ts

PluginRequirements Interface

No documentation comment.

interface PluginRequirements {
    /** Semver range checked against SAMVEYS_API_VERSION, e.g. `^1.0`. */
    readonly samveys?: string;
    readonly plugins?: readonly string[];
}

Exported from packages/core/src/contracts.ts

ProblemDetails Interface

RFC 9457 Problem Details object sent as `application/problem+json`.

interface ProblemDetails {
    /** `urn:samveys:error:<code>` for framework codes, otherwise `about:blank` or an app URI. */
    readonly type: string;
    readonly title: string;
    readonly status: number;
    readonly detail?: string;
    readonly instance?: string;
    /** Extension: stable `SVS_E*` code. */
    readonly code?: string;
    /** Extension: request id, also present in the logs. */
  …
Show the whole declaration (15 lines)
interface ProblemDetails {
    /** `urn:samveys:error:<code>` for framework codes, otherwise `about:blank` or an app URI. */
    readonly type: string;
    readonly title: string;
    readonly status: number;
    readonly detail?: string;
    readonly instance?: string;
    /** Extension: stable `SVS_E*` code. */
    readonly code?: string;
    /** Extension: request id, also present in the logs. */
    readonly requestId?: string;
    /** Extension: validation failures (422). */
    readonly errors?: readonly ValidationIssue[];
    readonly [extension: string]: unknown;
}

Exported from packages/core/src/contracts.ts

Provider Interface

No documentation comment.

interface Provider {
    readonly kind: 'provider';
    readonly name: string;
    readonly definition: ProviderDefinition;
}

Exported from packages/core/src/contracts.ts

ProviderDefinition Interface

No documentation comment.

interface ProviderDefinition extends LifecycleHooks<AppContext> {
    readonly name: string;
}

Exported from packages/core/src/contracts.ts

RequestContext Interface

Per-request data stored in AsyncLocalStorage; augment with user, tenant, locale.

interface RequestContext {
    readonly requestId: string;
    readonly startedAt: number;
    traceId?: string;
    locale?: string;
    /** The HTTP context when the request came through `@samveys/http`. */
    http?: HttpContext;
    /** Free-form per-request storage. */
    readonly locals: Map<string | symbol, unknown>;
}

Exported from packages/core/src/contracts.ts

ResolvedPlugin Interface

No documentation comment.

interface ResolvedPlugin {
    readonly plugin: Plugin;
    readonly scope: PluginScope;
    /** Position in the load order. */
    readonly order: number;
}

Exported from packages/core/src/plugins.ts

RouteInfo Interface

No documentation comment.

interface RouteInfo {
    readonly name: string | undefined;
    readonly method: string;
    readonly pattern: string;
}

Exported from packages/core/src/contracts.ts

SamveysConfig Interface

`samveys.config.ts` default export.

interface SamveysConfig {
    readonly name?: string;
    readonly plugins?: readonly PluginEntry[];
    readonly providers?: readonly Provider[];
    /** App config tree; merged over files loaded from `config/*.ts`. */
    readonly config?: Readonly<Record<string, unknown>>;
    readonly env?: EnvDefinition;
    /** Per shutdown handler, ms. Default 10000. */
    readonly shutdownTimeout?: number;
    readonly logger?: LoggerOptions;
  …
Show the whole declaration (13 lines)
interface SamveysConfig {
    readonly name?: string;
    readonly plugins?: readonly PluginEntry[];
    readonly providers?: readonly Provider[];
    /** App config tree; merged over files loaded from `config/*.ts`. */
    readonly config?: Readonly<Record<string, unknown>>;
    readonly env?: EnvDefinition;
    /** Per shutdown handler, ms. Default 10000. */
    readonly shutdownTimeout?: number;
    readonly logger?: LoggerOptions;
    /** Server entry run by `svs serve`. Default `bin/server.ts`. */
    readonly entry?: string;
}

Exported from packages/core/src/contracts.ts

SamveysErrorOptions Interface

No documentation comment.

interface SamveysErrorOptions {
    readonly cause?: unknown;
    /** Overrides the status from ERROR_CODES. */
    readonly status?: number;
    readonly issues?: readonly ValidationIssue[];
    /** Extra, non-sensitive data; included in logs, never in HTTP responses. */
    readonly meta?: Readonly<Record<string, unknown>>;
    /** When true, `message` is safe to send to clients as Problem Details `detail`. */
    readonly expose?: boolean;
}

Exported from packages/core/src/contracts.ts

SecretOptions Interface

No documentation comment.

interface SecretOptions {
    readonly optional?: boolean;
    readonly minLength?: number;
}

Exported from packages/core/src/env.ts

ShutdownResult Interface

No documentation comment.

interface ShutdownResult {
    /** 0 when every shutdown handler finished in time without throwing. */
    readonly exitCode: 0 | 1;
    /** Names of plugins/providers cut off by the timeout. */
    readonly timedOut: readonly string[];
    readonly errors: readonly {
        readonly name: string;
        readonly error: unknown;
    }[];
}

Exported from packages/core/src/contracts.ts

StandardSchemaV1 Interface

The Standard Schema interface.

interface StandardSchemaV1<Input = unknown, Output = Input> {
    readonly '~standard': StandardSchemaV1.Props<Input, Output>;
}

Exported from packages/core/src/contracts.ts

StringOptions Interface

No documentation comment.

interface StringOptions {
    readonly default?: string;
    readonly optional?: boolean;
    readonly choices?: readonly string[];
}

Exported from packages/core/src/env.ts

SystemCheck Interface

A system check run by `svs check`. IDs are stable, e.g. `core.app_key`.

interface SystemCheck {
    readonly id: string;
    readonly title: string;
    /** Only runs with `--deploy`. */
    readonly deployOnly?: boolean;
    run(context: CheckContext): CheckResult | Promise<CheckResult>;
}

Exported from packages/core/src/contracts.ts

UrlOptions Interface

No documentation comment.

interface UrlOptions {
    readonly default?: string;
    readonly optional?: boolean;
    /** Allowed schemes without the colon, e.g. `['postgres', 'postgresql']`. */
    readonly protocols?: readonly string[];
}

Exported from packages/core/src/env.ts

ValidationIssue Interface

One failing field in a validation problem (RFC 9457 §3 example shape).

interface ValidationIssue {
    /** RFC 6901 JSON Pointer in URI-fragment form, prefixed with the input part: `#/body/email`. */
    readonly pointer: string;
    readonly detail: string;
}

Exported from packages/core/src/contracts.ts

VerifyResult Interface

No documentation comment.

interface VerifyResult {
    readonly valid: boolean;
    /** New PHC string when the hash used other parameters and the password was valid. */
    readonly rehashed: string | undefined;
}

Exported from packages/core/src/contracts.ts

Type (39)

AbstractConstructor Type

A class usable as a token. Concrete zero-argument classes resolve without a binding.

type AbstractConstructor<T = unknown> = abstract new (...args: never) => T;

Exported from packages/core/src/contracts.ts

AnyToken Type

No documentation comment.

type AnyToken = Token<unknown> | BindingKey;

Exported from packages/core/src/contracts.ts

AppEnvironment Type

No documentation comment.

type AppEnvironment = 'local' | 'test' | 'staging' | 'production' | (string & {});

Exported from packages/core/src/contracts.ts

AppState Type

No documentation comment.

type AppState = 'created' | 'registered' | 'booted' | 'started' | 'ready' | 'terminating' | 'terminated';

Exported from packages/core/src/contracts.ts

ArgsOf Type

Turns an augmentable map entry into an argument tuple; `never` when the entry is not a tuple.

type ArgsOf<T> = T extends readonly unknown[] ? T : never;

Exported from packages/core/src/contracts.ts

BindingKey Type

No documentation comment.

type BindingKey = keyof ContainerBindings & string;

Exported from packages/core/src/contracts.ts

CheckResult Type

No documentation comment.

type CheckResult = {
    readonly status: 'pass';
    readonly message?: string;
} | {
    readonly status: 'warn' | 'fail';
    readonly message: string;
    readonly hint?: string;
};

Exported from packages/core/src/contracts.ts

ConfigPath Type

No documentation comment.

type ConfigPath = Paths<Config>;

Exported from packages/core/src/contracts.ts

EnvParseResult Type

No documentation comment.

type EnvParseResult<T> = {
    readonly ok: true;
    readonly value: T;
} | {
    readonly ok: false;
    readonly message: string;
};

Exported from packages/core/src/contracts.ts

EnvShape Type

No documentation comment.

type EnvShape = Readonly<Record<string, EnvRule<unknown>>>;

Exported from packages/core/src/contracts.ts

ErrorCode Type

No documentation comment.

type ErrorCode = keyof typeof ERROR_CODES;

Exported from packages/core/src/contracts.ts

EventListener Type

No documentation comment.

type EventListener<K extends EventName> = (payload: Events[K]) => void | Promise<void>;

Exported from packages/core/src/contracts.ts

EventName Type

No documentation comment.

type EventName = keyof Events & string;

Exported from packages/core/src/contracts.ts

Extend Type

`extend.*` as seen by plugins.

type Extend = {
    readonly [K in ExtensionPoint]: (...args: ExtensionArgs<K>) => void;

Exported from packages/core/src/contracts.ts

ExtensionArgs Type

No documentation comment.

type ExtensionArgs<K extends ExtensionPoint> = ArgsOf<ExtensionPoints[K]>;

Exported from packages/core/src/contracts.ts

ExtensionPoint Type

No documentation comment.

type ExtensionPoint = keyof ExtensionPoints & string;

Exported from packages/core/src/contracts.ts

Factory Type

No documentation comment.

type Factory<T> = (container: Container) => T;

Exported from packages/core/src/contracts.ts

HealthStatus Type

No documentation comment.

type HealthStatus = 'ok' | 'degraded' | 'down';

Exported from packages/core/src/contracts.ts

HookArgs Type

No documentation comment.

type HookArgs<K extends HookName> = ArgsOf<Hooks[K]>;

Exported from packages/core/src/contracts.ts

HookFilter Type

No documentation comment.

type HookFilter<K extends HookName> = (...args: HookArgs<K>) => HookValue<K> | Promise<HookValue<K>>;

Exported from packages/core/src/contracts.ts

HookInterceptor Type

No documentation comment.

type HookInterceptor<K extends HookName> = (...args: HookArgs<K>) => HookResult<K> | undefined | Promise<HookResult<K> | undefined>;

Exported from packages/core/src/contracts.ts

HookKind Type

No documentation comment.

type HookKind = 'on' | 'filter' | 'intercept';

Exported from packages/core/src/contracts.ts

HookListener Type

No documentation comment.

type HookListener<K extends HookName> = (...args: HookArgs<K>) => void | Promise<void>;

Exported from packages/core/src/contracts.ts

HookName Type

No documentation comment.

type HookName = keyof Hooks & string;

Exported from packages/core/src/contracts.ts

HookResult Type

No documentation comment.

type HookResult<K extends HookName> = K extends keyof HookResults ? HookResults[K] : never;

Exported from packages/core/src/contracts.ts

HookValue Type

No documentation comment.

type HookValue<K extends HookName> = HookArgs<K>[0];

Exported from packages/core/src/contracts.ts

InferEnv Type

No documentation comment.

type InferEnv<S extends EnvShape> = {
    readonly [K in keyof S]: S[K] extends EnvRule<infer T> ? T : never;
};

Exported from packages/core/src/contracts.ts

Lazy Type

A value, or a loader returning it (directly, as a promise, or as an ES module default export).

type Lazy<T> = T | (() => T | Promise<T> | Promise<{
    readonly default: T;
}>);

Exported from packages/core/src/contracts.ts

Lifetime Type

No documentation comment.

type Lifetime = 'singleton' | 'transient' | 'instance';

Exported from packages/core/src/contracts.ts

LogLevel Type

No documentation comment.

type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';

Exported from packages/core/src/contracts.ts

Paths Type

Dotted paths of `T`, up to 6 levels deep.

type Paths<T, Depth extends readonly unknown[] = []> = Depth['length'] extends 6 ? never : T extends ConfigLeaf ? never : {
    [K in keyof T & string]: T[K] extends ConfigLeaf ? K : K | `${K}.${Paths<T[K], [...Depth, 1]>}`;
}[keyof T & string];

Exported from packages/core/src/contracts.ts

PathValue Type

No documentation comment.

type PathValue<T, P extends string> = P extends `${infer Head}.${infer Rest}` ? Head extends keyof T ? PathValue<T[Head], Rest> : never : P extends keyof T ? T[P] : never;

Exported from packages/core/src/contracts.ts

PluginEntry Type

No documentation comment.

type PluginEntry = Plugin | PluginEntryOptions;

Exported from packages/core/src/contracts.ts

PluginFactory Type

`definePlugin()` returns this factory: `audit({ table: 'x' })`.

type PluginFactory<Input, C> = ((options?: Input) => Plugin<C>) & {

Exported from packages/core/src/contracts.ts

PluginScope Type

No documentation comment.

type PluginScope = 'global' | 'routes';

Exported from packages/core/src/contracts.ts

Token Type

No documentation comment.

type Token<T = unknown> = AbstractConstructor<T> | InjectionTokenLike<T>;

Exported from packages/core/src/contracts.ts

TokenValue Type

No documentation comment.

type TokenValue<K> = K extends BindingKey ? ContainerBindings[K] : K extends Token<infer T> ? T : never;

Exported from packages/core/src/contracts.ts

TracingChannelName Type

No documentation comment.

type TracingChannelName = (typeof TRACING_CHANNELS)[keyof typeof TRACING_CHANNELS];

Exported from packages/core/src/contracts.ts

Unsubscribe Type

Removes a registration (listener, hook, subscription). Idempotent.

type Unsubscribe = () => void;

Exported from packages/core/src/contracts.ts