@suluk/cost - v0.2.0
    Preparing search index...

    Interface CostMeterOptions

    interface CostMeterOptions {
        sink: CostSink;
        costs: Record<string, CostModel>;
        operationOf: (c: Context) => string | undefined;
        principalOf?: (c: Context) => string | undefined;
        actionHeader?: string;
        now?: () => number;
    }
    Index

    Properties

    sink: CostSink
    costs: Record<string, CostModel>

    operation name → its declared cost model.

    operationOf: (c: Context) => string | undefined

    Resolve the operation name for a request (e.g. c.get("operation"), or a matcher).

    principalOf?: (c: Context) => string | undefined

    Resolve the principal/user id (default: none).

    actionHeader?: string

    Header carrying the frontend action id (default "x-suluk-action").

    now?: () => number

    Wall-clock now (ms). Pass () => Date.now() in production; a fixed fn in tests for reproducibility.