/** * Creates bounded, immutable plain-data snapshots at configuration trust * boundaries. * * Traversal uses property descriptors exclusively. Accessor properties are * rejected without invoking their getters, and object prototypes are never * inherited by the returned snapshot. * * @module */ /** * Resource limits for a canonical configuration snapshot. * * `maxEstimatedBytes` is a conservative upper bound for UTF-8 JSON output: * every string code unit is charged at the longest JSON escape length. */ export interface ConfigSnapshotLimits { readonly maxDepth: number; readonly maxTotalNodes: number; readonly maxTotalProperties: number; readonly maxArrayLength: number; readonly maxObjectKeys: number; readonly maxKeyLength: number; readonly maxStringLength: number; readonly maxEstimatedBytes: number; } /** Fixed limits applied to every configuration snapshot. */ export declare const CONFIG_SNAPSHOT_LIMITS: Readonly; /** Primitive values supported by a configuration snapshot. */ export type ConfigSnapshotPrimitive = null | boolean | number | string; /** A deeply immutable, null-prototype configuration record. */ export interface ConfigSnapshotRecord { readonly [key: string]: ConfigSnapshotValue; } /** A value accepted and returned by {@link canonicalizeConfigSnapshot}. */ export type ConfigSnapshotValue = ConfigSnapshotPrimitive | ConfigSnapshotRecord | readonly ConfigSnapshotValue[]; /** Stable machine-readable reasons for snapshot rejection. */ export type ConfigSnapshotErrorCode = "accessor-property" | "dangerous-key" | "duplicate-reference" | "inspection-failed" | "invalid-array-shape" | "invalid-prototype" | "max-array-length-exceeded" | "max-depth-exceeded" | "max-estimated-bytes-exceeded" | "max-key-length-exceeded" | "max-nodes-exceeded" | "max-object-keys-exceeded" | "max-properties-exceeded" | "max-string-length-exceeded" | "non-enumerable-property" | "non-finite-number" | "symbol-key" | "unsupported-type"; /** Error raised when a value cannot be represented as a safe snapshot. */ export declare class ConfigSnapshotError extends TypeError { readonly code: ConfigSnapshotErrorCode; readonly path: string; constructor(code: ConfigSnapshotErrorCode, path: string, reason: string); } /** * Returns a detached, deeply frozen configuration snapshot. * * Records are rebuilt with null prototypes and canonical ECMAScript own-key * order: integer indices numerically, followed by other keys lexicographically. * Arrays retain the intrinsic array prototype for existing collection, JSON, * and structured-clone consumers, but their own state is rebuilt densely and * deeply frozen. * * Actively hostile values should reach this function through a non-executable * decoding boundary such as JSON parsing. JavaScript cannot reliably identify * proxies, whose reflection traps can execute during any descriptor walk. * * @throws {ConfigSnapshotError} when the input is not bounded plain data. */ export declare function canonicalizeConfigSnapshot(value: unknown): ConfigSnapshotValue; //# sourceMappingURL=snapshot.d.ts.map