@ghostry/fabricator 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +1 -7
  2. package/dist/esm/Error/index.js +8 -0
  3. package/dist/esm/Instance/Core.js +8 -17
  4. package/dist/esm/Instance/Stack/Async.js +10 -0
  5. package/dist/esm/Instance/Stack/Sync.js +16 -0
  6. package/dist/esm/Primitive/bigint/Registry.js +12 -12
  7. package/dist/esm/Primitive/boolean/Registry.js +2 -1
  8. package/dist/esm/Primitive/date/Registry.js +15 -14
  9. package/dist/esm/Primitive/null/Registry.js +2 -1
  10. package/dist/esm/Primitive/number/Registry.js +18 -17
  11. package/dist/esm/Primitive/symbol/Registry.js +2 -1
  12. package/dist/esm/Primitive/undefined/Registry.js +2 -1
  13. package/dist/esm/Random/CallSite.js +27 -13
  14. package/dist/esm/Utility/Core.js +6 -1
  15. package/dist/esm/index.js +4 -2
  16. package/dist/esm/internal.js +2 -1
  17. package/dist/types/Adapter/Core.d.ts +29 -32
  18. package/dist/types/Adapter/Types.d.ts +78 -88
  19. package/dist/types/Bound.d.ts +15 -15
  20. package/dist/types/Distribution/index.d.ts +54 -61
  21. package/dist/types/Enumeration/Enumerate.d.ts +21 -23
  22. package/dist/types/Enumeration/Plan.d.ts +22 -26
  23. package/dist/types/Enumeration/Types.d.ts +38 -43
  24. package/dist/types/Error/index.d.ts +94 -76
  25. package/dist/types/Fabricator/Constructor.d.ts +23 -25
  26. package/dist/types/Fabricator/Types.d.ts +73 -81
  27. package/dist/types/Instance/Core.d.ts +54 -73
  28. package/dist/types/Instance/Stack/Async.d.ts +14 -0
  29. package/dist/types/Instance/Stack/Sync.d.ts +14 -0
  30. package/dist/types/Instance/Types.d.ts +91 -89
  31. package/dist/types/Primitive/always/Schema.d.ts +8 -8
  32. package/dist/types/Primitive/always/Types.d.ts +7 -7
  33. package/dist/types/Primitive/array/Registry.d.ts +10 -8
  34. package/dist/types/Primitive/array/Schema.d.ts +4 -5
  35. package/dist/types/Primitive/array/Types.d.ts +6 -6
  36. package/dist/types/Primitive/bigint/Registry.d.ts +6 -6
  37. package/dist/types/Primitive/bigint/Schema.d.ts +8 -8
  38. package/dist/types/Primitive/bigint/Types.d.ts +5 -5
  39. package/dist/types/Primitive/boolean/Outcomes.d.ts +8 -8
  40. package/dist/types/Primitive/boolean/Registry.d.ts +2 -12
  41. package/dist/types/Primitive/boolean/Schema.d.ts +8 -8
  42. package/dist/types/Primitive/boolean/Types.d.ts +3 -3
  43. package/dist/types/Primitive/choice/Fabricator.d.ts +6 -7
  44. package/dist/types/Primitive/choice/Registry.d.ts +13 -13
  45. package/dist/types/Primitive/choice/Schema.d.ts +6 -6
  46. package/dist/types/Primitive/choice/Types.d.ts +11 -11
  47. package/dist/types/Primitive/date/Registry.d.ts +25 -48
  48. package/dist/types/Primitive/date/Schema.d.ts +9 -10
  49. package/dist/types/Primitive/date/Types.d.ts +4 -4
  50. package/dist/types/Primitive/enum/Registry.d.ts +13 -13
  51. package/dist/types/Primitive/enum/Schema.d.ts +5 -5
  52. package/dist/types/Primitive/enum/Types.d.ts +17 -19
  53. package/dist/types/Primitive/namespace.d.ts +10 -10
  54. package/dist/types/Primitive/null/Registry.d.ts +2 -2
  55. package/dist/types/Primitive/null/Schema.d.ts +2 -2
  56. package/dist/types/Primitive/null/Types.d.ts +3 -3
  57. package/dist/types/Primitive/nullable/Fabricator.d.ts +7 -7
  58. package/dist/types/Primitive/nullable/Schema.d.ts +13 -13
  59. package/dist/types/Primitive/nullable/Types.d.ts +9 -10
  60. package/dist/types/Primitive/nullish/Fabricator.d.ts +12 -13
  61. package/dist/types/Primitive/nullish/Schema.d.ts +8 -8
  62. package/dist/types/Primitive/nullish/Types.d.ts +12 -13
  63. package/dist/types/Primitive/number/Registry.d.ts +20 -38
  64. package/dist/types/Primitive/number/Schema.d.ts +11 -12
  65. package/dist/types/Primitive/number/Types.d.ts +13 -13
  66. package/dist/types/Primitive/number/defaults.d.ts +3 -3
  67. package/dist/types/Primitive/object/Fabricator.d.ts +15 -15
  68. package/dist/types/Primitive/object/Registry.d.ts +8 -8
  69. package/dist/types/Primitive/object/Schema.d.ts +10 -10
  70. package/dist/types/Primitive/object/Types.d.ts +20 -22
  71. package/dist/types/Primitive/object/compute/Fabricator.d.ts +4 -5
  72. package/dist/types/Primitive/object/compute/Schema.d.ts +4 -4
  73. package/dist/types/Primitive/object/compute/Types.d.ts +19 -20
  74. package/dist/types/Primitive/object/omittable/Fabricator.d.ts +10 -10
  75. package/dist/types/Primitive/object/omittable/Outcomes.d.ts +2 -2
  76. package/dist/types/Primitive/object/omittable/Schema.d.ts +11 -11
  77. package/dist/types/Primitive/object/omittable/Types.d.ts +14 -15
  78. package/dist/types/Primitive/object/optional/Fabricator.d.ts +16 -18
  79. package/dist/types/Primitive/object/optional/Outcomes.d.ts +2 -2
  80. package/dist/types/Primitive/object/optional/Schema.d.ts +4 -4
  81. package/dist/types/Primitive/object/optional/Types.d.ts +17 -17
  82. package/dist/types/Primitive/opaque/Registry.d.ts +3 -3
  83. package/dist/types/Primitive/opaque/Schema.d.ts +8 -9
  84. package/dist/types/Primitive/record/Registry.d.ts +8 -6
  85. package/dist/types/Primitive/record/Schema.d.ts +9 -11
  86. package/dist/types/Primitive/record/Types.d.ts +25 -25
  87. package/dist/types/Primitive/recursive/Fabricator.d.ts +16 -17
  88. package/dist/types/Primitive/recursive/Registry.d.ts +6 -7
  89. package/dist/types/Primitive/recursive/Schema.d.ts +8 -8
  90. package/dist/types/Primitive/recursive/Terminate.d.ts +13 -14
  91. package/dist/types/Primitive/recursive/Types.d.ts +31 -31
  92. package/dist/types/Primitive/recursive/self/Fabricator.d.ts +11 -12
  93. package/dist/types/Primitive/recursive/self/Schema.d.ts +10 -10
  94. package/dist/types/Primitive/recursive/self/Types.d.ts +7 -8
  95. package/dist/types/Primitive/string/Constants.d.ts +12 -13
  96. package/dist/types/Primitive/string/Fabricator.d.ts +2 -2
  97. package/dist/types/Primitive/string/Registry.d.ts +10 -16
  98. package/dist/types/Primitive/string/Schema.d.ts +5 -5
  99. package/dist/types/Primitive/string/Types.d.ts +17 -17
  100. package/dist/types/Primitive/symbol/Fabricator.d.ts +2 -2
  101. package/dist/types/Primitive/symbol/Registry.d.ts +4 -11
  102. package/dist/types/Primitive/symbol/Schema.d.ts +6 -6
  103. package/dist/types/Primitive/symbol/Types.d.ts +2 -2
  104. package/dist/types/Primitive/tuple/Fabricator.d.ts +7 -8
  105. package/dist/types/Primitive/tuple/Schema.d.ts +5 -5
  106. package/dist/types/Primitive/tuple/Types.d.ts +24 -25
  107. package/dist/types/Primitive/undefinable/Fabricator.d.ts +7 -7
  108. package/dist/types/Primitive/undefinable/Schema.d.ts +13 -13
  109. package/dist/types/Primitive/undefinable/Types.d.ts +10 -10
  110. package/dist/types/Primitive/undefined/Registry.d.ts +2 -2
  111. package/dist/types/Primitive/undefined/Schema.d.ts +4 -4
  112. package/dist/types/Primitive/undefined/Types.d.ts +3 -3
  113. package/dist/types/Random/CallSite.d.ts +63 -44
  114. package/dist/types/Random/Generator/sfc32.d.ts +4 -4
  115. package/dist/types/Random/Types.d.ts +214 -236
  116. package/dist/types/Random/index.d.ts +63 -70
  117. package/dist/types/Schema/Core.d.ts +19 -21
  118. package/dist/types/Schema/Registry.d.ts +3 -3
  119. package/dist/types/Schema/Types.d.ts +41 -48
  120. package/dist/types/Types.d.ts +39 -45
  121. package/dist/types/Utility/Core.d.ts +18 -9
  122. package/dist/types/index.d.ts +110 -108
  123. package/dist/types/internal.d.ts +68 -37
  124. package/package.json +17 -5
@@ -2,15 +2,14 @@ import type { Adaptations } from "../../../Adapter/Types";
2
2
  import { Produces, type Adaptation, type Kind, type Meta } from "../../../Types";
3
3
  /**
4
4
  * The value a `self` reference resolves to at this position — whatever the
5
- * enclosing `T.recursive`'s current expansion binds it to. Reads
6
- * `bindings[0]`, the analogue of TypeBox's `TThis` reading
7
- * `this['params'][0]`; see `Schema/Types.ts`'s `ValueOf` for what
8
- * `bindings` is and why it's a tuple.
5
+ * enclosing `T.recursive`'s current expansion binds it to. Reads `bindings[0]`,
6
+ * the analogue of TypeBox's `TThis` reading `this['params'][0]`; see
7
+ * `Schema/Types.ts`'s `ValueOf` for what `bindings` is and why it's a tuple.
9
8
  *
10
- * Unlike every other kind, `self` has no type parameter of its own — its
11
- * whole value comes from outside, threaded in structurally by whatever
12
- * composite kinds wrap it (`recursive/Types.ts`'s `RecursiveValue` is what
13
- * ultimately supplies `bindings[0]`).
9
+ * Unlike every other kind, `self` has no type parameter of its own — its whole
10
+ * value comes from outside, threaded in structurally by whatever composite
11
+ * kinds wrap it (`recursive/Types.ts`'s `RecursiveValue` is what ultimately
12
+ * supplies `bindings[0]`).
14
13
  */
15
14
  export type Fabricated<$Bindings extends unknown[] = []> = $Bindings[0];
16
15
  export type Meta = Record<string, never>;
@@ -1,14 +1,13 @@
1
1
  import type { CodepointRange } from "./Types";
2
2
  /**
3
- * Unicode code point ranges for spanning the codespace — a fuzzing aid
4
- * for exercising input far outside ordinary text. Use a preset or build
5
- * an arbitrary inclusive range with `range(from, to)`.
3
+ * Unicode code point ranges for spanning the codespace — a fuzzing aid for
4
+ * exercising input far outside ordinary text. Use a preset or build an
5
+ * arbitrary inclusive range with `range(from, to)`.
6
6
  *
7
- * Lives here rather than `Types.ts` so that file stays type-only. A
8
- * value export alongside `export type Fabricated = string` makes the
9
- * module a value module, and `export * as string` in
10
- * `Primitive/namespace.ts` then resolves `string` to the namespace —
11
- * a cycle that drops `[Kind]`/`[Meta]` off `Core`.
7
+ * Lives here rather than `Types.ts` so that file stays type-only. A value
8
+ * export alongside `export type Fabricated = string` makes the module a value
9
+ * module, and `export * as string` in `Primitive/namespace.ts` then resolves
10
+ * `string` to the namespace — a cycle that drops `[Kind]`/`[Meta]` off `Core`.
12
11
  */
13
12
  export declare const unicode: {
14
13
  /**
@@ -24,8 +23,8 @@ export declare const unicode: {
24
23
  }[];
25
24
  /**
26
25
  * The entire Unicode codespace, U+0000–U+10FFFF, including the surrogate
27
- * block — so it can yield lone surrogates and thus ill-formed UTF-16.
28
- * Opt in for lone surrogates and other ill-formed UTF-16 when fuzzing.
26
+ * block — so it can yield lone surrogates and thus ill-formed UTF-16. Opt in
27
+ * for lone surrogates and other ill-formed UTF-16 when fuzzing.
29
28
  */
30
29
  codespace: {
31
30
  from: number;
@@ -45,9 +44,9 @@ export declare const unicode: {
45
44
  range: (from: number, to: number) => CodepointRange;
46
45
  };
47
46
  /**
48
- * The built-in character classes as code point ranges, each an alias for
49
- * the code point ranges it spans. For use in the `[weight, source]` form
50
- * of `composition` (e.g. mixing a class with a Unicode range).
47
+ * The built-in character classes as code point ranges, each an alias for the
48
+ * code point ranges it spans. For use in the `[weight, source]` form of
49
+ * `composition` (e.g. mixing a class with a Unicode range).
51
50
  */
52
51
  export declare const classes: {
53
52
  lowercase: ReadonlyArray<CodepointRange>;
@@ -18,7 +18,7 @@ export type Fabricator<$Schema extends {
18
18
  };
19
19
  /**
20
20
  * Turn a `string` Schema into a live Fabricator — the one place this kind's
21
- * character-generation logic actually runs. `Constructor.ts` calls this once per
22
- * `construct()`, never from inside the returned `fabricate`.
21
+ * character-generation logic actually runs. `Constructor.ts` calls this once
22
+ * per `construct()`, never from inside the returned `fabricate`.
23
23
  */
24
24
  export declare function Fabricator(context: FabricatorContext<Schema>): Fabricator;
@@ -1,12 +1,12 @@
1
1
  import type { Produce } from "../../Random/Types";
2
2
  import { Kind } from "../../Types";
3
3
  import { Schema } from "./Schema";
4
- import type { Fabricated, InputWhereby, JsonSchema } from "./Types";
4
+ import type { Fabricated, InputWhereby, JsonSchema, Whereby } from "./Types";
5
5
  declare const _default: {
6
6
  /**
7
- * The builder carries the primitive's `[Kind]` so it can be named directly
8
- * as a `compute` source — which derives its schema by kind — without
9
- * first satisfying a `whereby`.
7
+ * The builder carries the primitive's `[Kind]` so it can be named directly as
8
+ * a `compute` source — which derives its schema by kind — without first
9
+ * satisfying a `whereby`.
10
10
  */
11
11
  [Kind]: "string";
12
12
  /**
@@ -15,9 +15,9 @@ declare const _default: {
15
15
  * (e.g. `toTypeBox`) read.
16
16
  */
17
17
  as: (produce: Produce<Fabricated>, hints?: JsonSchema) => Schema<{
18
- produce: Produce<string>;
18
+ produce: Produce<Fabricated>;
19
19
  hints: JsonSchema | undefined;
20
- }, {}>;
20
+ }>;
21
21
  /**
22
22
  * A string whose length falls uniformly within `[length.min, length.max]`;
23
23
  * `length.min` defaults to inclusive 0. Exclusive ends use a Bound object.
@@ -28,17 +28,11 @@ declare const _default: {
28
28
  * `length` counts UTF-16 code units, so the result's `.length` equals the
29
29
  * chosen length exactly. When the composition cannot fill the final code
30
30
  * units — e.g. only astral, two-unit characters remain for a one-unit gap —
31
- * the gap is topped up with a well-formed BMP character outside the
32
- * requested `composition`, inserted at a random character boundary.
31
+ * the gap is topped up with a well-formed BMP character outside the requested
32
+ * `composition`, inserted at a random character boundary.
33
33
  */
34
34
  whereby: (whereby: InputWhereby) => Schema<{
35
- whereby: {
36
- length: {
37
- min: import("../..").Bound<number>;
38
- max: import("../..").Bound<number>;
39
- };
40
- composition?: import("./Types").Composition;
41
- };
42
- }, {}>;
35
+ whereby: Whereby;
36
+ }>;
43
37
  };
44
38
  export default _default;
@@ -4,13 +4,13 @@ import type { Produce } from "../../Random/Types";
4
4
  import type { Core, Fabricated, JsonSchema, Meta as ThisMeta } from "./Types";
5
5
  /**
6
6
  * Buildable `string` recipe: length/composition (`whereby` — required, unlike
7
- * `number`/`date`; no natural bound to fuzz a length to), or opaque
8
- * production via `as`.
7
+ * `number`/`date`; no natural bound to fuzz a length to), or opaque production
8
+ * via `as`.
9
9
  *
10
10
  * `$Meta` is generic (defaulting to the full `Meta` union) so builder return
11
- * types stay narrow — see `number/Schema.ts`. `$Adaptations` is generic for
12
- * the same reason, threaded through every builder method so an adaptation
13
- * survives chaining (see `adapt`).
11
+ * types stay narrow — see `number/Schema.ts`. `$Adaptations` is generic for the
12
+ * same reason, threaded through every builder method so an adaptation survives
13
+ * chaining (see `adapt`).
14
14
  */
15
15
  export interface Schema<$Meta extends ThisMeta = ThisMeta, $Adaptations extends Adaptations = {}> extends Core<$Meta, $Adaptations> {
16
16
  /**
@@ -9,19 +9,19 @@ export type CodepointRange = {
9
9
  to: number;
10
10
  };
11
11
  /**
12
- * The single mechanism every character is drawn from: one or more code
13
- * point ranges. A literal string is accepted as shorthand for the ranges
14
- * of its individual characters, so custom pools, the built-in classes, and
15
- * the Unicode codespace are all the same thing under the hood.
12
+ * The single mechanism every character is drawn from: one or more code point
13
+ * ranges. A literal string is accepted as shorthand for the ranges of its
14
+ * individual characters, so custom pools, the built-in classes, and the Unicode
15
+ * codespace are all the same thing under the hood.
16
16
  */
17
17
  export type CharacterSource = string | CodepointRange | ReadonlyArray<CodepointRange>;
18
18
  export type CharacterClass = keyof typeof classes;
19
19
  /**
20
- * How a string's characters should be composed: a weighting over the
21
- * built-in classes by name, or explicit `[weight, source]` pairs over
22
- * arbitrary character sources. Each character independently picks a source
23
- * by weight, then a code point uniformly across that source's ranges — so
24
- * the weights describe expected composition, not per-character uniformity.
20
+ * How a string's characters should be composed: a weighting over the built-in
21
+ * classes by name, or explicit `[weight, source]` pairs over arbitrary
22
+ * character sources. Each character independently picks a source by weight,
23
+ * then a code point uniformly across that source's ranges — so the weights
24
+ * describe expected composition, not per-character uniformity.
25
25
  */
26
26
  export type Composition = Partial<Record<CharacterClass, number>> | ReadonlyArray<[number, CharacterSource]>;
27
27
  export type InputWhereby = {
@@ -41,9 +41,9 @@ export type Whereby = {
41
41
  export type Fabricated = string;
42
42
  /**
43
43
  * JSON-Schema keywords that constrain a string value — carried as neutral,
44
- * schema-library-agnostic hints (see the builder's `as`). Adapters forward
45
- * them to their target: `toTypeBox` to `Type.String(...)`, a future `toZod`
46
- * to `z.string()` refinements, etc.
44
+ * schema-library-agnostic hints (see the builder's `as`). Adapters forward them
45
+ * to their target: `toTypeBox` to `Type.String(...)`, a future `toZod` to
46
+ * `z.string()` refinements, etc.
47
47
  *
48
48
  * Length lives on `whereby` as Bound pairs, which adapters forward as
49
49
  * `minLength`/`maxLength`; `hints` never duplicates it — these are the
@@ -54,11 +54,11 @@ export type JsonSchema = {
54
54
  pattern?: string;
55
55
  };
56
56
  /**
57
- * A length/composition, drawn via `whereby` — no natural bound to fuzz to,
58
- * so unlike `number`/`date` there's no bare form — optionally overridden
59
- * by an opaque `as` production, carried alongside `whereby` rather than
60
- * replacing it (when `whereby` was already set) so a prior
61
- * length/composition survives `as` for future validation.
57
+ * A length/composition, drawn via `whereby` — no natural bound to fuzz to, so
58
+ * unlike `number`/`date` there's no bare form — optionally overridden by an
59
+ * opaque `as` production, carried alongside `whereby` rather than replacing it
60
+ * (when `whereby` was already set) so a prior length/composition survives `as`
61
+ * for future validation.
62
62
  */
63
63
  export type Meta = {
64
64
  whereby: Whereby;
@@ -18,7 +18,7 @@ export type Fabricator<$Schema extends {
18
18
  };
19
19
  /**
20
20
  * A bare symbol draws no randomness at all — `Symbol(meta.key)` is
21
- * deterministic — so only the `.as(...)`-overridden path ever obtains a
22
- * stream. The bare path still records `trace`, like every other node.
21
+ * deterministic — so only the `.as(...)`-overridden path ever obtains a stream.
22
+ * The bare path still records `trace`, like every other node.
23
23
  */
24
24
  export declare function Fabricator(context: FabricatorContext<Schema>): Fabricator;
@@ -1,16 +1,9 @@
1
1
  import type { Adaptations } from "../../Adapter/Types";
2
- import { Adaptation, Kind, Meta, Produces } from "../../Types";
3
2
  import { Schema } from "./Schema";
4
- import type { Fabricated } from "./Types";
5
- declare const _default: {
6
- [Kind]: "symbol";
7
- [Meta]: {};
8
- [Produces]?: Fabricated;
9
- [Adaptation]?: Adaptations;
10
- as: (produce: import("../../Random/Types").Produce<Fabricated>) => Schema<{}, Adaptations>;
11
- adapt: <const $Adapter extends import("../..").Adapter, $Returnable extends ReturnType<$Adapter["convert"]>>(adapter: $Adapter, produce: (adapting: import("../..").Adapting<Schema<{}, Adaptations>>) => $Returnable) => Schema<{}, import("../../Adapter/Types").WithAdaptations<Adaptations, import("../../Adapter/Core").AdaptationEntry<$Adapter, $Returnable>>>;
3
+ type ThisRegistry = Schema<{}, Adaptations> & {
12
4
  keyed: (key: string) => Schema<{
13
5
  key: string;
14
- }, {}>;
6
+ }>;
15
7
  };
16
- export default _default;
8
+ declare const registry: ThisRegistry;
9
+ export default registry;
@@ -3,10 +3,10 @@ import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adap
3
3
  import type { Produce } from "../../Random/Types";
4
4
  import type { Core, Fabricated, Meta as ThisMeta } from "./Types";
5
5
  /**
6
- * `$Meta` is generic (defaulting to the full `Meta` union) so builder
7
- * return types stay narrow — see `number/Schema.ts`. `$Adaptations` is
8
- * threaded through every builder method for the same reason — see
9
- * `string/Schema.ts`'s `adapt`.
6
+ * `$Meta` is generic (defaulting to the full `Meta` union) so builder return
7
+ * types stay narrow — see `number/Schema.ts`. `$Adaptations` is threaded
8
+ * through every builder method for the same reason — see `string/Schema.ts`'s
9
+ * `adapt`.
10
10
  */
11
11
  export interface Schema<$Meta extends ThisMeta = ThisMeta, $Adaptations extends Adaptations = {}> extends Core<$Meta, $Adaptations> {
12
12
  /**
@@ -16,8 +16,8 @@ export interface Schema<$Meta extends ThisMeta = ThisMeta, $Adaptations extends
16
16
  */
17
17
  as: (produce: Produce<Fabricated>) => Schema<$Meta, $Adaptations>;
18
18
  /**
19
- * Override what this schema maps to in one or more external schema
20
- * libraries — see `string/Schema.ts`'s `adapt` for the full contract.
19
+ * Override what this schema maps to in one or more external schema libraries
20
+ * — see `string/Schema.ts`'s `adapt` for the full contract.
21
21
  */
22
22
  adapt: <const $Adapter extends Adapter, $Returnable extends ReturnType<$Adapter["convert"]>>(adapter: $Adapter, produce: (adapting: Adapting<Schema<$Meta, $Adaptations>>) => $Returnable) => Schema<$Meta, WithAdaptations<$Adaptations, AdaptationEntry<$Adapter, $Returnable>>>;
23
23
  }
@@ -4,8 +4,8 @@ import type { Adaptation, Kind, Meta, Produces } from "../../Types";
4
4
  export type Fabricated = symbol;
5
5
  /**
6
6
  * A symbol keyed via `keyed`, or unkeyed if `key` is absent, optionally
7
- * overridden by an opaque `as` production — carried alongside `key` rather
8
- * than replacing it, so a prior keying survives `as` for future validation.
7
+ * overridden by an opaque `as` production — carried alongside `key` rather than
8
+ * replacing it, so a prior keying survives `as` for future validation.
9
9
  */
10
10
  export type Meta = {
11
11
  key?: string;
@@ -20,18 +20,17 @@ export type Fabricator<$Schema extends {
20
20
  schema: Schema<$Schema[typeof Meta]["items"], AdaptationsOf<$Schema>>;
21
21
  };
22
22
  /**
23
- * `elements` are each slot's *already-dispatched* Fabricator, one per
23
+ * `elements` are each slot's _already-dispatched_ Fabricator, one per
24
24
  * `[Meta].items` entry, built by `Constructor.ts`'s `make` before this call —
25
25
  * mirrors `choice.Fabricator`'s `weightings`, one per option, rather than
26
26
  * `array.Fabricator`'s single shared `element`. The `array`/`tuple`
27
- * distinction: each slot gets its own private stream, so
28
- * `T.tuple([T.number, T.number])` behaves like a two-field `object` of
29
- * numbers, not a length-2 `array` of numbers (every element drawn
30
- * sequentially off one shared stream).
27
+ * distinction: each slot gets its own private stream, so `T.tuple([T.number,
28
+ * T.number])` behaves like a two-field `object` of numbers, not a length-2
29
+ * `array` of numbers (every element drawn sequentially off one shared stream).
31
30
  *
32
31
  * `toStreamFromTrace` is only consulted on the `.as(...)`-overridden path: an
33
- * ordinary tuple draws no randomness of its own — every draw belongs to a
34
- * slot, exactly like `object`. `trace` is still recorded so a nested
35
- * tuple can be replayed from its own schema.
32
+ * ordinary tuple draws no randomness of its own — every draw belongs to a slot,
33
+ * exactly like `object`. `trace` is still recorded so a nested tuple can be
34
+ * replayed from its own schema.
36
35
  */
37
36
  export declare function Fabricator<$Items extends Items>(context: FabricatorContext<Schema<$Items>>, elements: ReadonlyArray<NaiveFabricator<any>>): Fabricator<Schema<$Items>>;
@@ -4,9 +4,9 @@ import type { Produce } from "../../Random/Types";
4
4
  import type { Core, Fabricated, Items } from "./Types";
5
5
  /**
6
6
  * Buildable `tuple` recipe: a fixed-length list of slot schemas, each
7
- * fabricated independently — see `Fabricator.ts` for why that independence
8
- * (one Fabricator per slot, not one reused across slots like `array`'s
9
- * single element) is the defining difference from `array`.
7
+ * fabricated independently — see `Fabricator.ts` for why that independence (one
8
+ * Fabricator per slot, not one reused across slots like `array`'s single
9
+ * element) is the defining difference from `array`.
10
10
  */
11
11
  export interface Schema<$Items extends Items = Items, $Adaptations extends Adaptations = {}> extends Core<$Items, $Adaptations> {
12
12
  /**
@@ -16,8 +16,8 @@ export interface Schema<$Items extends Items = Items, $Adaptations extends Adapt
16
16
  */
17
17
  as: (produce: Produce<Fabricated<$Items>>) => Schema<$Items, $Adaptations>;
18
18
  /**
19
- * Override what this schema maps to in one or more external schema
20
- * libraries — see `string/Schema.ts`'s `adapt` for the full contract.
19
+ * Override what this schema maps to in one or more external schema libraries
20
+ * — see `string/Schema.ts`'s `adapt` for the full contract.
21
21
  */
22
22
  adapt: <const $Adapter extends Adapter, $Returnable extends ReturnType<$Adapter["convert"]>>(adapter: $Adapter, produce: (adapting: Adapting<Schema<$Items, $Adaptations>>) => $Returnable) => Schema<$Items, WithAdaptations<$Adaptations, AdaptationEntry<$Adapter, $Returnable>>>;
23
23
  }
@@ -5,40 +5,39 @@ import type { Adaptation, Kind, Meta, Produces } from "../../Types";
5
5
  /** The schema occupying a single tuple slot. */
6
6
  export type Item = AnySchema;
7
7
  /**
8
- * A *tuple* of schemas, one per slot — not a flattened `ReadonlyArray`, for
9
- * the same reason `choice.Items` isn't (see its doc): a widened array
10
- * remembers only the union of every slot's type and loses arity and which
11
- * slot held what. The real tuple is what lets `Fabricated` resolve to
12
- * positional `[A, B]` rather than `(A | B)[]`, and `Adapter/TypeBox` produce
13
- * a `TTuple` of the right length.
8
+ * A _tuple_ of schemas, one per slot — not a flattened `ReadonlyArray`, for the
9
+ * same reason `choice.Items` isn't (see its doc): a widened array remembers
10
+ * only the union of every slot's type and loses arity and which slot held what.
11
+ * The real tuple is what lets `Fabricated` resolve to positional `[A, B]`
12
+ * rather than `(A | B)[]`, and `Adapter/TypeBox` produce a `TTuple` of the
13
+ * right length.
14
14
  */
15
15
  export type Items = ReadonlyArray<Item>;
16
16
  /**
17
- * Head/tail recursion, not a homomorphic `{ [$K in keyof $Items]: ... }`
18
- * mapped type — the same trap `Adapter/TypeBox`'s `ChoiceOptions`/
19
- * `TupleItems` avoid: `keyof` a still-abstract `ReadonlyArray<Item>` (this
20
- * type's default, and what a kind-local `Fabrication<$Fabricator>` resolves
21
- * against for the *bare*, unparameterized `Fabricator`) pulls in
22
- * `"length"`/method keys that don't resolve to a sensible `ValueOf`. A
23
- * homomorphic version type-checks for any concrete tuple but silently
24
- * produces a malformed bare type, which then fails `.schema.as`'s
25
- * contravariant parameter check against any concrete instantiation
26
- * (`Fabrication.types.test.ts`). Matching a fixed-length tuple pattern at
27
- * every step avoids it, as `TupleItems` does for `ToTypeBox`. The fallback
28
- * (a genuinely widened, arity-less array) is a plain `Array<...>`, mirroring
29
- * `array.Fabricated` for the same bare case.
17
+ * Head/tail recursion, not a homomorphic `{ [$K in keyof $Items]: ... }` mapped
18
+ * type — the same trap `Adapter/TypeBox`'s `ChoiceOptions`/ `TupleItems` avoid:
19
+ * `keyof` a still-abstract `ReadonlyArray<Item>` (this type's default, and what
20
+ * a kind-local `Fabrication<$Fabricator>` resolves against for the _bare_,
21
+ * unparameterized `Fabricator`) pulls in `"length"`/method keys that don't
22
+ * resolve to a sensible `ValueOf`. A homomorphic version type-checks for any
23
+ * concrete tuple but silently produces a malformed bare type, which then fails
24
+ * `.schema.as`'s contravariant parameter check against any concrete
25
+ * instantiation (`Fabrication.types.test.ts`). Matching a fixed-length tuple
26
+ * pattern at every step avoids it, as `TupleItems` does for `ToTypeBox`. The
27
+ * fallback (a genuinely widened, arity-less array) is a plain `Array<...>`,
28
+ * mirroring `array.Fabricated` for the same bare case.
30
29
  */
31
30
  export type Fabricated<$Items extends Items = Items, $Bindings extends unknown[] = []> = $Items extends readonly [] ? [] : $Items extends readonly [
32
31
  infer $Head extends Item,
33
32
  ...infer $Rest extends Items
34
33
  ] ? [ValueOf<$Head, $Bindings>, ...Fabricated<$Rest, $Bindings>] : Array<ValueOf<$Items[number], $Bindings>>;
35
34
  /**
36
- * No `whereby`: arity is fixed at `T.tuple([...])` and there is nothing left
37
- * to configure. Unlike `array`'s two-variant union this needs no
38
- * "config or produce" split — `produce` is a plain optional layered on top,
39
- * and `items` stays required so `extend`-less kinds still have the per-slot
40
- * shapes `ToTypeBox` derives from (and future validation of `produce` would
41
- * check against).
35
+ * No `whereby`: arity is fixed at `T.tuple([...])` and there is nothing left to
36
+ * configure. Unlike `array`'s two-variant union this needs no "config or
37
+ * produce" split — `produce` is a plain optional layered on top, and `items`
38
+ * stays required so `extend`-less kinds still have the per-slot shapes
39
+ * `ToTypeBox` derives from (and future validation of `produce` would check
40
+ * against).
42
41
  */
43
42
  export type Meta<$Items extends Items = Items> = {
44
43
  items: $Items;
@@ -19,13 +19,13 @@ export type Fabricator<$Schema extends {
19
19
  fabricate: () => Fabricated<$Schema[typeof Meta]["definition"]>;
20
20
  };
21
21
  /**
22
- * A presence roll on this field's private stream, drawn only when the
23
- * wrapped value is needed — an `undefined` roll never advances `source`'s
24
- * stream, and since `source` is already dispatched into its own independent
25
- * stream by `Constructor.ts` regardless of this roll, skipping its draw
26
- * here can never perturb any other field's reproducibility (see
22
+ * A presence roll on this field's private stream, drawn only when the wrapped
23
+ * value is needed — an `undefined` roll never advances `source`'s stream, and
24
+ * since `source` is already dispatched into its own independent stream by
25
+ * `Constructor.ts` regardless of this roll, skipping its draw here can never
26
+ * perturb any other field's reproducibility (see
27
27
  * `object/omittable/Fabricator.ts`, and CLAUDE.md's "Randomness"). 50/50 by
28
- * default; `.weighted(...)` (`Schema.ts`) reweights either outcome relative
29
- * to that same default of `1`.
28
+ * default; `.weighted(...)` (`Schema.ts`) reweights either outcome relative to
29
+ * that same default of `1`.
30
30
  */
31
31
  export declare function Fabricator<$Definition extends Definition>(context: FabricatorContext<Schema<$Definition>>, source: BaseFabricator<any>): Fabricator<Schema<$Definition>>;
@@ -4,31 +4,31 @@ import type { Produce } from "../../Random/Types";
4
4
  import type { AnySchema } from "../../Schema/Types";
5
5
  import type { Core, Definition, Fabricated, Weights } from "./Types";
6
6
  /**
7
- * The buildable recipe for an `undefinable`: a single wrapped Schema, drawn
8
- * (or not) each fabrication.
7
+ * The buildable recipe for an `undefinable`: a single wrapped Schema, drawn (or
8
+ * not) each fabrication.
9
9
  */
10
10
  export interface Schema<$Definition extends Definition = Definition, $Adaptations extends Adaptations = {}> extends Core<$Definition, $Adaptations> {
11
11
  /**
12
12
  * Layer an opaque production on this schema's existing `[Meta]` — carrying
13
- * `definition` forward, not discarding it, so a later `.as(...)` (or
14
- * future validation of `produce`) still has it to check against.
15
- * `produce` may return `undefined`, so custom logic composes the same way
16
- * the built-in roll does.
13
+ * `definition` forward, not discarding it, so a later `.as(...)` (or future
14
+ * validation of `produce`) still has it to check against. `produce` may
15
+ * return `undefined`, so custom logic composes the same way the built-in roll
16
+ * does.
17
17
  */
18
18
  as: (produce: Produce<Fabricated<$Definition>>) => Schema<$Definition, $Adaptations>;
19
19
  /**
20
- * Reweight the built-in 50/50 roll. Keys are optional — an omitted key
21
- * keeps baseline weight `1`, the same weight the 50/50 split already uses
22
- * — but that baseline is still relative to whatever else is specified, so
20
+ * Reweight the built-in 50/50 roll. Keys are optional — an omitted key keeps
21
+ * baseline weight `1`, the same weight the 50/50 split already uses — but
22
+ * that baseline is still relative to whatever else is specified, so
23
23
  * `.weighted({ undefined: 0.1 })` shifts both outcomes' shares, not just
24
24
  * `undefined`'s (see `Types.ts`'s `Weights`). Chaining `.weighted(...)`
25
- * merges into previous weights rather than replacing them, the same
26
- * layering `.as(...)` uses for `produce`.
25
+ * merges into previous weights rather than replacing them, the same layering
26
+ * `.as(...)` uses for `produce`.
27
27
  */
28
28
  weighted: (weights: Weights) => Schema<$Definition, $Adaptations>;
29
29
  /**
30
- * Override what this schema maps to in one or more external schema
31
- * libraries — see `string/Schema.ts`'s `adapt` for the full contract.
30
+ * Override what this schema maps to in one or more external schema libraries
31
+ * — see `string/Schema.ts`'s `adapt` for the full contract.
32
32
  */
33
33
  adapt: <const $Adapter extends Adapter, $Returnable extends ReturnType<$Adapter["convert"]>>(adapter: $Adapter, produce: (adapting: Adapting<Schema<$Definition, $Adaptations>>) => $Returnable) => Schema<$Definition, WithAdaptations<$Adaptations, AdaptationEntry<$Adapter, $Returnable>>>;
34
34
  }
@@ -7,19 +7,19 @@ export type Definition = AnySchema;
7
7
  export type Fabricated<$Definition extends Definition, $Bindings extends unknown[] = []> = ValueOf<$Definition, $Bindings> | undefined;
8
8
  export type { Outcome } from "./Outcomes";
9
9
  /**
10
- * Relative weights for `.weighted(...)`, keyed by `Outcome`. Keys optional —
11
- * an omitted key falls back to baseline `1`, the same weight the 50/50
12
- * split already uses. Values are relative, exactly like `weighted()`
10
+ * Relative weights for `.weighted(...)`, keyed by `Outcome`. Keys optional — an
11
+ * omitted key falls back to baseline `1`, the same weight the 50/50 split
12
+ * already uses. Values are relative, exactly like `weighted()`
13
13
  * (`Distribution/index.ts`) — they need not sum to one, and are fed to
14
14
  * `weighted()` unchanged alongside each unspecified key's baseline `1`.
15
15
  *
16
- * Specifying one outcome's weight shifts the *other* outcome's resulting
17
- * probability too, even though its weight stays at `1` — its share of the
18
- * total still moves, since the total changed. `.weighted({ undefined: 0.1 })`
19
- * is not "10% undefined, 90% present" — with `value` at default `1`, the
20
- * split is `0.1 / 1.1 ≈ 9.1%` undefined, `≈90.9%` value. No independent
21
- * "absolute probability" mode; weights are only meaningful relative to the
22
- * full set in play.
16
+ * Specifying one outcome's weight shifts the _other_ outcome's resulting
17
+ * probability too, even though its weight stays at `1` — its share of the total
18
+ * still moves, since the total changed. `.weighted({ undefined: 0.1 })` is not
19
+ * "10% undefined, 90% present" — with `value` at default `1`, the split is `0.1
20
+ * / 1.1 ≈ 9.1%` undefined, `≈90.9%` value. No independent "absolute
21
+ * probability" mode; weights are only meaningful relative to the full set in
22
+ * play.
23
23
  */
24
24
  export type Weights = {
25
25
  undefined: number;
@@ -1,3 +1,3 @@
1
1
  import { Schema } from "./Schema";
2
- declare const _default: Schema<{}>;
3
- export default _default;
2
+ declare const registry: Schema;
3
+ export default registry;
@@ -3,13 +3,13 @@ import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adap
3
3
  import type { Core, Meta as ThisMeta } from "./Types";
4
4
  /**
5
5
  * Nothing to configure (see `Types.ts`'s `Meta`), so `adapt` is this kind's
6
- * only builder method — an external library that spells "undefined"
7
- * differently still needs a way to say so.
6
+ * only builder method — an external library that spells "undefined" differently
7
+ * still needs a way to say so.
8
8
  */
9
9
  export interface Schema<$Adaptations extends Adaptations = {}> extends Core<ThisMeta, $Adaptations> {
10
10
  /**
11
- * Override what this schema maps to in one or more external schema
12
- * libraries — see `string/Schema.ts`'s `adapt` for the full contract.
11
+ * Override what this schema maps to in one or more external schema libraries
12
+ * — see `string/Schema.ts`'s `adapt` for the full contract.
13
13
  */
14
14
  adapt: <const $Adapter extends Adapter, $Returnable extends ReturnType<$Adapter["convert"]>>(adapter: $Adapter, produce: (adapting: Adapting<Schema<$Adaptations>>) => $Returnable) => Schema<WithAdaptations<$Adaptations, AdaptationEntry<$Adapter, $Returnable>>>;
15
15
  }
@@ -2,9 +2,9 @@ import type { Adaptations } from "../../Adapter/Types";
2
2
  import type { Adaptation, Kind, Meta, Produces } from "../../Types";
3
3
  export type Fabricated = undefined;
4
4
  /**
5
- * Nothing to configure: `undefined` has exactly one possible value, so
6
- * there is no `.as()` (see `always/Types.ts` for the same reasoning) and
7
- * no other knob to carry.
5
+ * Nothing to configure: `undefined` has exactly one possible value, so there is
6
+ * no `.as()` (see `always/Types.ts` for the same reasoning) and no other knob
7
+ * to carry.
8
8
  */
9
9
  export type Meta = Record<string, never>;
10
10
  export type Core<$Meta extends Meta = Meta, $Adaptations extends Adaptations = {}> = {