export { shield }; export { shieldIsMissing }; export { shieldApply }; export { shieldToHumandReadable }; export { registerShieldType }; export { verifyOuter }; export { shieldKey }; export { logShieldError }; export { buildShieldValidators }; export { __applyReturnShields, __applyArgumentShields, resolveReturnShields, getArgumentShields }; export type { ShieldValidator, ShieldValidators, ValueShields, ShieldLogConfig, ShieldValidatorCtx }; /** The subset of `config.log.shieldErrors` that gates server-side logging of shield failures. */ type ShieldLogConfig = { dev: boolean; prod: boolean; }; /** Context needed to format and gate a shield-error log at a per-call validation site. */ type ShieldValidatorCtx = { telefunctionName: string; telefuncFilePath: string; shieldErrors: ShieldLogConfig; }; /** Structured shield-error detail — `logShieldError` owns the message formatting so every * caller passes only the parts it has context for. */ type ShieldErrorDetail = { telefunctionName: string; telefuncFilePath: string; /** Describes what failed — e.g. "the arguments passed to the telefunction" or * "data validated by 'next'". Rendered verbatim. */ subject: string; /** The raw verifier output (human-readable breadcrumb). */ wrongType: string; /** Optional extra sentence appended before `wrongType` (e.g. JSON of arguments). */ extra?: string; }; /** Write a shield-error message to the server log, gated by `config.log.shieldErrors`. * Single site owning the "Shield Validation Error:" prefix and message shape. */ declare function logShieldError(detail: ShieldErrorDetail, shieldErrors: ShieldLogConfig): void; /** Turn `{ name: shieldExpr }` entries into a `ShieldValidators` map where each validator * runs `verifyOuter` and auto-logs on failure. Single source for per-call validator building * — used by both the request-side reviver path and the response-side replacer path. */ declare function buildShieldValidators(entries: Record, ctx: ShieldValidatorCtx): ShieldValidators; /** A shield validator — returns `true` on success, or a formatted error string on failure. */ type ShieldValidator = (...values: unknown[]) => true | string; /** Map of named shield validators for a single value (e.g. a channel's 'data' and 'ack' validators). */ type ShieldValidators = Map; /** Request-local binding: per-value shield maps. Built once per request by walking the return value. */ type ValueShields = WeakMap; /** Raw shield metadata: one verifier tuple per named entry. */ type ShieldMap = Record; declare const shieldKey = "__telefunc_shield"; declare const isVerifierKey = "__telefunc_isVerifier"; declare const isVerifierTupleKey = "__telefunc_isVerifierTuple"; type ShieldOptions = { __autoGenerated?: boolean; }; declare const shield: { unknown>(telefunction: Telefunction, telefunctionShield: TelefunctionArguments, options?: ShieldOptions): Telefunction; unknown>(telefunctionShield: TelefunctionArguments, telefunction: Telefunction, options?: ShieldOptions): Telefunction; type: typeof type; }; type Telefunction = Function; declare function shieldIsMissing(telefunction: Telefunction): boolean; declare function shieldApply(telefunction: Telefunction, args: unknown[]): true | string; type TelefunctionShield = unknown[] | Verifier; declare function shieldToHumandReadable(telefunctionShield: TelefunctionShield): string; declare function verifyOuter(verifier: unknown, args: unknown): true | string; declare const type: { string: string; number: number; boolean: boolean; date: Date; file: File; blob: Blob; readableStream: ReadableStream; function: Function; array: (arrayType: T) => T[]; object: (objectType: T) => Record; or: (...elements: T) => T[number]; tuple: (...elements: T) => T; const: | Readonly | Readonly | undefined | null>(val: T) => T; optional: (param: T) => T | undefined; nullable: (param: T) => T | null; any: any; never: never; }; declare function registerShieldType(name: string, verify: (input: unknown) => boolean): void; type Verifier = ((input: unknown, breadcrumbs: string) => true | string) & { [isVerifierKey]?: true; [isVerifierTupleKey]?: true; }; /** Called by generated code at module load — stores return shield metadata on the telefunction. * `shields` maps each shielded path in the return value to a named map of verifier tuples. */ declare function __applyReturnShields(fn: Function, shields: Record): void; /** Called by generated code at module load — stores argument shield metadata on the telefunction. * `shields` maps each shielded path in the arguments (rooted at arg index) to a named map of verifier tuples. */ declare function __applyArgumentShields(fn: Function, shields: Record): void; /** Called at runtime after a telefunction returns — walks the return tree and resolves the telefunction's * shield metadata into per-value bindings. The serializer looks up values in this map during replacement. */ declare function resolveReturnShields(result: unknown, telefunction: Function): ValueShields; /** Returns the telefunction's argument shield map (path → ShieldMap), or undefined if none declared. * Consumed by the request-side reviver to build per-path validators at revive time. */ declare function getArgumentShields(telefunction: Function): Record | undefined;