/** * Bounds and input validation for the durable application command mailbox * (WFT-84). * * Every bound here exists so a hostile or buggy caller cannot grow durable * storage without limit or push an unbounded string into a storage key. The * mailbox validates at admission — before any write — so a rejected command * leaves no trace. * * @module core/mailbox-validation */ import type { ApplicationCommandInput, MailboxOptions } from './mailbox-contract.ts'; import type { ApplicationCommandPayload } from './mailbox-types.ts'; /** Mailbox defaults resolved once at construction. */ export type ResolvedMailboxPolicy = Readonly<{ namespace: string; resourceId: string; maxBacklog: number; visibilityTimeoutMs: number; commandTimeoutMs: number; maxAttempts: number; retryBackoffMs: number; maxRetryBackoffMs: number; terminalRetentionMs: number; maxInlinePayloadBytes: number; maintenanceBatchSize: number; }>; /** * Resolve and range-check the mailbox construction options. * * @throws {ApplicationCommandValidationError} When any option is out of range. */ export declare function resolveMailboxPolicy(options: MailboxOptions): ResolvedMailboxPolicy; /** A validated command input with its digest and effective per-command policy resolved. */ export type ValidatedCommandInput = Readonly<{ caller: string; target: string; kind: string; payload: ApplicationCommandPayload; payloadDigest: string; payloadMediaType?: string | undefined; payloadSchema?: string | undefined; idempotencyKey?: string | undefined; causation?: ApplicationCommandInput['causation'] | undefined; availableAfterMs: number; maxAttempts: number; visibilityTimeoutMs: number; commandTimeoutMs: number; }>; /** * Validate one command offered for admission and resolve its effective policy. * * @throws {ApplicationCommandValidationError} When any field is missing, * oversized, or out of range. */ export declare function validateCommandInput(input: ApplicationCommandInput, policy: ResolvedMailboxPolicy): Promise; export { ApplicationCommandValidationError, clampListLimit, DEFAULT_WAIT_POLL_INTERVAL_MS, MAX_APPLICATION_COMMAND_ATTEMPTS, MAX_APPLICATION_IDEMPOTENCY_KEY_BYTES, MAX_APPLICATION_IDENTITY_BYTES, MAX_APPLICATION_PAYLOAD_REFERENCE_BYTES, MAX_CANCELLATION_REASON_BYTES, MAX_FAILURE_MESSAGE_BYTES, MAX_MAILBOX_BACKLOG, MAX_MAILBOX_LIST_LIMIT, requireClockInstant, requireDerivedInstant, requireGeneratedIdentifier, requireMaintenanceInstant, requireWaitBudget, validateCancellationReason, validateDurableJSONValue, validateFailure, } from './mailbox-guards.ts'; /** * Validate a caller-supplied command id before it reaches key construction. * * Every command-scoped operation builds a storage key from this value, and * `encodeURIComponent` throws a raw `URIError` on an unpaired surrogate; the * contract says caller mistakes surface as `ApplicationCommandValidationError`. */ export declare function validateCommandIdentifier(commandId: unknown): string;