import type { CompressionAlgorithm } from '../compress/types.js'; import type { JsonObject } from '../json.js'; import type { ResourceLimits } from '../limits.js'; import type { SafetyProfile } from '../safety.js'; import type { ArchiveErrorCode } from './errors.js'; import type { CompressionErrorCode } from '../compress/errors.js'; import type { ZipIssueCode } from '../types.js'; export type { ResourceLimits } from '../limits.js'; export type { SafetyProfile } from '../safety.js'; /** Supported archive and compression format identifiers. */ export type ArchiveFormat = 'zip' | 'tar' | 'gz' | 'tgz' | 'tar.gz' | 'bz2' | 'tar.bz2' | 'zst' | 'br' | 'tar.zst' | 'tar.br' | 'xz' | 'tar.xz'; /** Severity level for archive issues. */ export type ArchiveIssueSeverity = 'info' | 'warning' | 'error'; /** How the archive input was provided. */ export type ArchiveInputKind = 'file' | 'url' | 'bytes' | 'stream' | 'blob'; /** Detection report for layered archives and compression. */ export type ArchiveDetectionReport = { /** How the caller supplied input bytes/stream/blob/path/url. */ inputKind: ArchiveInputKind; /** Container/compression detection details. */ detected: { /** Container kind when present (`zip`/`tar`). */ container?: 'zip' | 'tar'; /** Compression layer when present (`gzip`/`xz`/etc.). */ compression?: CompressionAlgorithm | 'none'; /** Ordered container/compression labels describing the full stack. */ layers: Array<'zip' | 'tar' | CompressionAlgorithm>; }; /** Confidence score for detection source (`forced`, filename hint, magic bytes). */ confidence: 'high' | 'medium' | 'low'; /** Supplemental notes describing how detection concluded. */ notes: string[]; }; /** A single audit/normalize issue found in an archive. */ export type ArchiveIssueCode = ArchiveErrorCode | CompressionErrorCode | ZipIssueCode | 'COMPRESSION_RESOURCE_PREFLIGHT_INCOMPLETE' | 'BROTLI_LIMIT_EXCEEDED' | 'BZIP2_LIMIT_EXCEEDED' | 'GZIP_LIMIT_EXCEEDED' | 'XZ_LIMIT_EXCEEDED' | 'ZSTD_LIMIT_EXCEEDED' | 'TAR_BAD_HEADER' | 'TAR_CASE_COLLISION' | 'TAR_DUPLICATE_ENTRY' | 'TAR_LIMIT_EXCEEDED' | 'TAR_PARSE_FAILED' | 'TAR_PATH_TRAVERSAL' | 'TAR_SYMLINK_PRESENT' | 'TAR_UNICODE_COLLISION' | 'TAR_UNSUPPORTED_ENTRY'; /** A single audit/normalize issue found in an archive. */ export type ArchiveIssue = { /** Stable machine code for filtering and alerting. */ code: ArchiveIssueCode; /** Severity for policy decisions (`info`/`warning`/`error`). */ severity: ArchiveIssueSeverity; /** Human-readable explanation of the issue. */ message: string; /** Entry path when the issue is tied to one archive member. */ entryName?: string; /** Byte offset string when available from parser state. */ offset?: string; /** Additional structured context for machine consumers. */ details?: JsonObject; }; /** Audit summary for an archive. */ export type ArchiveAuditReport = { /** Whether the archive satisfies the reader's safety profile. */ isSafe: boolean; /** Aggregate counts from the audit pass. */ summary: { /** Number of entries observed in the archive. */ entryCount: number; /** Count of warning-severity issues. */ warningCount: number; /** Count of error-severity issues. */ errorCount: number; /** Total payload bytes when available. */ totalByteCount?: number; }; /** Full issue list with stable machine codes. */ issues: ArchiveIssue[]; }; /** Normalize summary for an archive. */ export type ArchiveNormalizeReport = { /** True when normalize completed without error-severity issues. */ isSuccessful: boolean; /** Aggregate counts from normalize output. */ summary: { /** Number of input entries inspected. */ entryCount: number; /** Number of entries emitted to normalized output. */ outputEntryCount: number; /** Entries dropped by normalize policy. */ droppedEntryCount: number; /** Entries renamed to resolve conflicts. */ renamedEntryCount: number; /** Warning-severity issue count. */ warningCount: number; /** Error-severity issue count. */ errorCount: number; }; /** Full issue list with stable machine codes. */ issues: ArchiveIssue[]; }; /** Limits for archive processing and validation. */ export type ArchiveLimits = ResourceLimits; /** Normalized view of an archive entry. */ export type ArchiveEntry = { /** Entry format family used by this reader (`zip`, `tar`, etc.). */ format: ArchiveFormat; /** Normalized entry path (forward-slash separators). */ name: string; /** Uncompressed entry size in bytes. */ size: bigint; /** True when the entry represents a directory. */ isDirectory: boolean; /** True when the entry represents a symbolic link. */ isSymlink: boolean; /** Entry modified time when present in source metadata. */ mtime?: Date; /** Entry mode bits when present. */ mode?: number; /** Entry uid when present. */ uid?: number; /** Entry gid when present. */ gid?: number; /** Symlink target path when entry is a link. */ linkName?: string; /** Lazy stream opener for entry payload bytes. */ open: () => Promise>; }; /** ZIP-specific options accepted by the unified archive reader. */ export type ArchiveZipOpenOptions = { /** Retain parsed ZIP entries for repeated access. */ shouldStoreEntries?: boolean; /** HTTP range-read settings for seekable URL inputs. */ http?: { /** Additional request headers. */ headers?: Record; /** In-memory range block cache settings. */ cache?: { blockSize?: number; maxBlocks?: number; }; /** Abort signal for HTTP requests. */ signal?: AbortSignal; /** Validator policy for remote resource consistency. */ snapshotPolicy?: 'require-strong-etag' | 'best-effort'; }; }; /** TAR-specific options accepted by the unified archive reader. */ export type ArchiveTarOpenOptions = { /** Retain parsed TAR entries for repeated access. */ shouldStoreEntries?: boolean; }; /** Options for opening/detecting archives. */ export type ArchiveOpenOptions = { /** Force format or use `auto` detection (default). */ format?: ArchiveFormat | 'auto'; /** Safety preset used for validation and default resource limits. */ safetyProfile?: SafetyProfile; /** Resource ceilings for input/decompression/extraction. */ limits?: ArchiveLimits; /** Abort signal for open/detect/list pipelines. */ signal?: AbortSignal; /** Password used for encrypted ZIP members. */ password?: string; /** Filename hint used when byte-level detection is ambiguous. */ filename?: string; /** URL admission policy for runtime adapters. */ url?: { /** Allow insecure `http:` archive URLs outside the web runtime. */ allowHttp?: boolean; }; /** Explicit input kind override for reporting. */ inputKind?: ArchiveInputKind; /** ZIP-reader specific passthrough options. */ zip?: ArchiveZipOpenOptions; /** TAR-reader specific passthrough options. */ tar?: ArchiveTarOpenOptions; }; //# sourceMappingURL=types.d.ts.map