import type { Schema } from 'effect'; import * as fc from 'fast-check'; export { hasTag } from '@czap/error'; /** * Annotation key for an explicit, schema-authored fast-check arbitrary. A * schema whose VALID domain is a generated SUBSET of an opaque carrier type — * e.g. "canonical CBOR bytes" is a subset of `Uint8Array`, not every byte * string — cannot be sampled by structural walking: random `fc.uint8Array()` * bytes are conformant to the carrier (`instanceOf(Uint8Array)`) yet outside * the handler's real domain. The author who KNOWS how to generate valid * values attaches that generator here via {@link withArbitrary}; the walker * honours it ahead of structural derivation. This is the canonical, shared * hook for "the input schema under-specifies the handler's domain" — the fix * lives ON the schema (a branded smart constructor), not in a per-capsule * harness hack. * * The annotated value is a THUNK (`() => fc.Arbitrary`) so the * arbitrary is built lazily at walk time, never eagerly at module load. */ export declare const ArbitraryAnnotationId: unique symbol; /** The thunk shape an {@link ArbitraryAnnotationId} annotation carries. */ export type ArbitraryAnnotation = () => fc.Arbitrary; /** * Brand a schema with an explicit arbitrary generator (see * {@link ArbitraryAnnotationId}). The result is the SAME schema for parsing / * encoding — only its harness-sampling behaviour changes. Use this to express * a narrow valid domain a structural walk can't reach (e.g. * `withArbitrary(Schema.instanceOf(Uint8Array), () => fc.anything().map(CanonicalCbor.encode))`). */ export declare function withArbitrary>(schema: S, arbitrary: ArbitraryAnnotation): S; /** * Walk a `Schema` AST and return a `fc.Arbitrary` that produces values * structurally conforming to the schema. Throws * `UnsupportedError` on AST nodes with no supported mapping. * * Accepts any `Schema.Schema` (or `Codec`) — only `.ast` is read. */ declare function _schemaToArbitrary(schema: Schema.Schema): fc.Arbitrary; /** Public namespace for the arbitrary-from-schema walker. */ export declare const ArbitraryFromSchema: { readonly fromSchema: typeof _schemaToArbitrary; }; /** Convenience top-level export — most call sites use this directly. */ export declare const schemaToArbitrary: typeof _schemaToArbitrary; export declare namespace ArbitraryFromSchema { /** The result type returned by {@link ArbitraryFromSchema.fromSchema}. */ type Result = fc.Arbitrary; } //# sourceMappingURL=arbitrary-from-schema.d.ts.map