/** * Tenant / topic / consumerGroup identifier validation. * * The same string flows into: * - Azure Blob paths (`//...`). * - Postgres `LISTEN`/`NOTIFY` channel names (`bds__`). * - DuckDB SQL string literals (`'az://container///segments/...'`). * * Letting arbitrary caller-supplied strings reach those sinks is a class of * security and correctness risk on its own: empty tenants collapse blob paths * (`/topic/...` crosses isolation boundaries), traversal sequences (`../admin`) * can address blobs outside the intended prefix, and Postgres / DuckDB take * different sanitisation routes that don't compose well. * * One regex, one error, one validator. Called from the public entry points * (`Producer.start`, `Consumer.start`, `Consumer.replay`, and the * `createSignalEmitter` / `createSignalListener` helpers) BEFORE any I/O so * the error fires at construction time, not as a cryptic 4xx mid-run. */ /** * Maximum identifier length. 128 chars is comfortable headroom under both * Postgres `NAMEDATALEN-1` (63) — `bds__` may already be * truncated by the channel-name builder, but that is a separate concern — * and Azure Blob name limits (1024 bytes total path). */ export declare const IDENTIFIER_MAX_LENGTH = 128; /** * Thrown when a Producer / Consumer / Replay option fails validation at * construction time. The `field` and `value` properties let callers * programmatically distinguish which knob misbehaved. */ export declare class InvalidOptionError extends Error { readonly field: string; readonly value: unknown; constructor(field: string, value: unknown, detail: string); } /** * Reject any identifier (tenant, topic, consumerGroup, ...) that does not * match the safe shape. Throws {@link InvalidOptionError} on failure. * * @param value the raw value as passed by the caller (typed `unknown` so * callers don't need to defensively coerce — the validator handles it). * @param fieldName the option name for the resulting error message. */ export declare function validateIdentifier(value: unknown, fieldName: string): asserts value is string; /** * Stricter validator for the Postgres schema name. Accepts only * `[A-Za-z_][A-Za-z0-9_]*` (no leading digit, no hyphen) so the value can * be interpolated unquoted into SQL — see {@link SQL_SCHEMA_PATTERN}. */ export declare function validateSchemaName(value: unknown, fieldName: string): asserts value is string; /** * Validate a numeric option against `{min, max, integer}` constraints. * `undefined` is treated as "caller did not supply this option" and is * always accepted (the caller's default applies). Anything else must be * a finite number satisfying the constraint. Throws * {@link InvalidOptionError} on failure. * * Used to clamp the many numeric knobs (`leaseTtlSeconds`, * `pollIntervalMs`, `commitEveryN`, `coalesceWindowMs`, etc.) at the API * boundary instead of letting silently-wrong values surface as cryptic * Azure errors mid-run. */ export declare function validateNumberOption(value: unknown, fieldName: string, constraints: { readonly min: number; readonly max: number; readonly integer?: boolean; }): void; //# sourceMappingURL=identifiers.d.ts.map