@ghostry/fabricator 0.0.13 → 0.0.15
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.
- package/dist/esm/Bound.js +74 -1
- package/dist/esm/Distribution/index.js +103 -2
- package/dist/esm/Enumeration/Enumerate.js +10 -5
- package/dist/esm/Enumeration/Plan.js +2 -2
- package/dist/esm/Error/index.js +96 -27
- package/dist/esm/Fabricator/Constructor.js +7 -5
- package/dist/esm/Instance/Core.js +3 -0
- package/dist/esm/Primitive/array/Admits.js +18 -0
- package/dist/esm/Primitive/array/Fabricator.js +20 -2
- package/dist/esm/Primitive/array/Registry.js +32 -0
- package/dist/esm/Primitive/array/Schema.js +8 -0
- package/dist/esm/Primitive/bigint/Admits.js +11 -0
- package/dist/esm/Primitive/bigint/Fabricator.js +16 -23
- package/dist/esm/Primitive/bigint/Registry.js +17 -6
- package/dist/esm/Primitive/bigint/Schema.js +8 -0
- package/dist/esm/Primitive/date/Admits.js +22 -0
- package/dist/esm/Primitive/date/Defaults.js +27 -1
- package/dist/esm/Primitive/date/Fabricator.js +32 -34
- package/dist/esm/Primitive/date/Registry.js +80 -13
- package/dist/esm/Primitive/date/Schema.js +8 -0
- package/dist/esm/Primitive/enum/Fabricator.js +14 -2
- package/dist/esm/Primitive/enum/Registry.js +38 -25
- package/dist/esm/Primitive/index.js +1 -0
- package/dist/esm/Primitive/number/Admits.js +27 -0
- package/dist/esm/Primitive/number/Fabricator.js +18 -9
- package/dist/esm/Primitive/number/Registry.js +55 -4
- package/dist/esm/Primitive/number/Schema.js +10 -3
- package/dist/esm/Primitive/object/Fabricator.js +2 -0
- package/dist/esm/Primitive/record/Admits.js +42 -0
- package/dist/esm/Primitive/record/Fabricator.js +49 -19
- package/dist/esm/Primitive/record/Registry.js +29 -0
- package/dist/esm/Primitive/record/Schema.js +8 -0
- package/dist/esm/Primitive/recursive/Fabricator.js +3 -2
- package/dist/esm/Primitive/recursive/Terminate.js +16 -2
- package/dist/esm/Primitive/string/Admits.js +26 -0
- package/dist/esm/Primitive/string/Capacity.js +81 -0
- package/dist/esm/Primitive/string/Fabricator.js +23 -43
- package/dist/esm/Primitive/string/Registry.js +31 -9
- package/dist/esm/Primitive/string/Schema.js +10 -3
- package/dist/esm/Primitive/string/Sources.js +41 -0
- package/dist/esm/Primitive/unique/Registry.js +22 -0
- package/dist/esm/Primitive/unique/index.js +2 -0
- package/dist/esm/Types.js +2 -1
- package/dist/esm/Unique/Capacity.js +85 -0
- package/dist/esm/Unique/Distinct.js +187 -0
- package/dist/esm/Unique/Key.js +70 -0
- package/dist/esm/Unique/Override.js +23 -0
- package/dist/esm/Unique/Strategy.js +173 -0
- package/dist/esm/internal.js +1 -0
- package/dist/types/Adapter/Core.d.ts +2 -2
- package/dist/types/Adapter/Types.d.ts +1 -1
- package/dist/types/Bound.d.ts +67 -1
- package/dist/types/Distribution/index.d.ts +83 -1
- package/dist/types/Enumeration/Enumerate.d.ts +3 -3
- package/dist/types/Enumeration/Plan.d.ts +1 -1
- package/dist/types/Enumeration/Types.d.ts +14 -5
- package/dist/types/Error/index.d.ts +283 -0
- package/dist/types/Fabricator/Constructor.d.ts +9 -5
- package/dist/types/Fabricator/Fabricate.d.ts +5 -5
- package/dist/types/Fabricator/Types.d.ts +19 -6
- package/dist/types/Harnessing/Core.d.ts +3 -3
- package/dist/types/Harnessing/Salt.d.ts +1 -1
- package/dist/types/Harnessing/Types.d.ts +2 -2
- package/dist/types/Instance/Core.d.ts +4 -4
- package/dist/types/Instance/Stack/Async.d.ts +1 -1
- package/dist/types/Instance/Stack/Sync.d.ts +1 -1
- package/dist/types/Instance/Stack/Visible.d.ts +2 -2
- package/dist/types/Instance/Types.d.ts +19 -5
- package/dist/types/Primitive/always/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/always/Registry.d.ts +2 -2
- package/dist/types/Primitive/always/Schema.d.ts +4 -4
- package/dist/types/Primitive/always/Types.d.ts +2 -2
- package/dist/types/Primitive/always/index.d.ts +5 -5
- package/dist/types/Primitive/array/Admits.d.ts +7 -0
- package/dist/types/Primitive/array/Fabricator.d.ts +7 -7
- package/dist/types/Primitive/array/Registry.d.ts +40 -3
- package/dist/types/Primitive/array/Schema.d.ts +10 -5
- package/dist/types/Primitive/array/Types.d.ts +37 -5
- package/dist/types/Primitive/array/index.d.ts +5 -5
- package/dist/types/Primitive/bigint/Admits.d.ts +7 -0
- package/dist/types/Primitive/bigint/Fabricator.d.ts +8 -6
- package/dist/types/Primitive/bigint/Registry.d.ts +24 -4
- package/dist/types/Primitive/bigint/Schema.d.ts +13 -5
- package/dist/types/Primitive/bigint/Types.d.ts +30 -6
- package/dist/types/Primitive/bigint/index.d.ts +5 -5
- package/dist/types/Primitive/boolean/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/boolean/Registry.d.ts +2 -2
- package/dist/types/Primitive/boolean/Schema.d.ts +5 -5
- package/dist/types/Primitive/boolean/Types.d.ts +3 -3
- package/dist/types/Primitive/boolean/index.d.ts +6 -6
- package/dist/types/Primitive/choice/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/choice/Registry.d.ts +2 -2
- package/dist/types/Primitive/choice/Schema.d.ts +5 -5
- package/dist/types/Primitive/choice/Types.d.ts +4 -4
- package/dist/types/Primitive/choice/index.d.ts +5 -5
- package/dist/types/Primitive/date/Admits.d.ts +7 -0
- package/dist/types/Primitive/date/Defaults.d.ts +22 -1
- package/dist/types/Primitive/date/Fabricator.d.ts +8 -6
- package/dist/types/Primitive/date/Registry.d.ts +49 -13
- package/dist/types/Primitive/date/Schema.d.ts +14 -5
- package/dist/types/Primitive/date/Types.d.ts +57 -8
- package/dist/types/Primitive/date/index.d.ts +5 -5
- package/dist/types/Primitive/derive/Fabricator.d.ts +7 -7
- package/dist/types/Primitive/derive/Registry.d.ts +2 -2
- package/dist/types/Primitive/derive/Schema.d.ts +6 -6
- package/dist/types/Primitive/derive/Types.d.ts +6 -6
- package/dist/types/Primitive/derive/index.d.ts +5 -5
- package/dist/types/Primitive/enum/Fabricator.d.ts +8 -6
- package/dist/types/Primitive/enum/Registry.d.ts +22 -2
- package/dist/types/Primitive/enum/Schema.d.ts +5 -5
- package/dist/types/Primitive/enum/Types.d.ts +8 -3
- package/dist/types/Primitive/enum/index.d.ts +5 -5
- package/dist/types/Primitive/index.d.ts +28 -27
- package/dist/types/Primitive/namespace.d.ts +21 -21
- package/dist/types/Primitive/null/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/null/Registry.d.ts +1 -1
- package/dist/types/Primitive/null/Schema.d.ts +4 -4
- package/dist/types/Primitive/null/Types.d.ts +2 -2
- package/dist/types/Primitive/null/index.d.ts +5 -5
- package/dist/types/Primitive/nullable/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/nullable/Registry.d.ts +2 -2
- package/dist/types/Primitive/nullable/Schema.d.ts +6 -6
- package/dist/types/Primitive/nullable/Types.d.ts +5 -5
- package/dist/types/Primitive/nullable/index.d.ts +6 -6
- package/dist/types/Primitive/nullish/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/nullish/Registry.d.ts +2 -2
- package/dist/types/Primitive/nullish/Schema.d.ts +6 -6
- package/dist/types/Primitive/nullish/Types.d.ts +5 -5
- package/dist/types/Primitive/nullish/index.d.ts +6 -6
- package/dist/types/Primitive/number/Admits.d.ts +9 -0
- package/dist/types/Primitive/number/Defaults.d.ts +1 -1
- package/dist/types/Primitive/number/Fabricator.d.ts +8 -6
- package/dist/types/Primitive/number/Registry.d.ts +45 -4
- package/dist/types/Primitive/number/Schema.d.ts +14 -6
- package/dist/types/Primitive/number/Types.d.ts +36 -14
- package/dist/types/Primitive/number/index.d.ts +5 -5
- package/dist/types/Primitive/object/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/object/Registry.d.ts +4 -4
- package/dist/types/Primitive/object/Schema.d.ts +8 -8
- package/dist/types/Primitive/object/Types.d.ts +6 -6
- package/dist/types/Primitive/object/compute/Fabricator.d.ts +7 -7
- package/dist/types/Primitive/object/compute/Registry.d.ts +2 -2
- package/dist/types/Primitive/object/compute/Schema.d.ts +7 -7
- package/dist/types/Primitive/object/compute/Types.d.ts +3 -3
- package/dist/types/Primitive/object/compute/index.d.ts +5 -5
- package/dist/types/Primitive/object/index.d.ts +8 -8
- package/dist/types/Primitive/object/omit/Registry.d.ts +2 -2
- package/dist/types/Primitive/object/omit/index.d.ts +2 -2
- package/dist/types/Primitive/object/omittable/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/object/omittable/Registry.d.ts +2 -2
- package/dist/types/Primitive/object/omittable/Schema.d.ts +6 -6
- package/dist/types/Primitive/object/omittable/Types.d.ts +5 -5
- package/dist/types/Primitive/object/omittable/index.d.ts +6 -6
- package/dist/types/Primitive/object/optional/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/object/optional/Registry.d.ts +2 -2
- package/dist/types/Primitive/object/optional/Schema.d.ts +6 -6
- package/dist/types/Primitive/object/optional/Types.d.ts +5 -5
- package/dist/types/Primitive/object/optional/index.d.ts +6 -6
- package/dist/types/Primitive/object/pick/Registry.d.ts +2 -2
- package/dist/types/Primitive/object/pick/index.d.ts +2 -2
- package/dist/types/Primitive/opaque/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/opaque/Registry.d.ts +2 -2
- package/dist/types/Primitive/opaque/Schema.d.ts +4 -4
- package/dist/types/Primitive/opaque/Types.d.ts +3 -3
- package/dist/types/Primitive/opaque/index.d.ts +5 -5
- package/dist/types/Primitive/record/Admits.d.ts +18 -0
- package/dist/types/Primitive/record/Fabricator.d.ts +7 -7
- package/dist/types/Primitive/record/Registry.d.ts +20 -3
- package/dist/types/Primitive/record/Schema.d.ts +12 -5
- package/dist/types/Primitive/record/Types.d.ts +64 -10
- package/dist/types/Primitive/record/index.d.ts +5 -5
- package/dist/types/Primitive/recursive/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/recursive/Registry.d.ts +4 -4
- package/dist/types/Primitive/recursive/Schema.d.ts +4 -4
- package/dist/types/Primitive/recursive/Terminate.d.ts +8 -1
- package/dist/types/Primitive/recursive/Types.d.ts +3 -3
- package/dist/types/Primitive/recursive/index.d.ts +6 -6
- package/dist/types/Primitive/recursive/self/Fabricator.d.ts +5 -5
- package/dist/types/Primitive/recursive/self/Registry.d.ts +1 -1
- package/dist/types/Primitive/recursive/self/Schema.d.ts +4 -4
- package/dist/types/Primitive/recursive/self/Types.d.ts +2 -2
- package/dist/types/Primitive/recursive/self/index.d.ts +5 -5
- package/dist/types/Primitive/string/Admits.d.ts +8 -0
- package/dist/types/Primitive/string/Capacity.d.ts +36 -0
- package/dist/types/Primitive/string/Constants.d.ts +1 -1
- package/dist/types/Primitive/string/Fabricator.d.ts +8 -6
- package/dist/types/Primitive/string/Registry.d.ts +29 -8
- package/dist/types/Primitive/string/Schema.d.ts +32 -6
- package/dist/types/Primitive/string/Sources.d.ts +16 -0
- package/dist/types/Primitive/string/Types.d.ts +39 -19
- package/dist/types/Primitive/string/index.d.ts +6 -6
- package/dist/types/Primitive/symbol/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/symbol/Registry.d.ts +2 -2
- package/dist/types/Primitive/symbol/Schema.d.ts +5 -5
- package/dist/types/Primitive/symbol/Types.d.ts +3 -3
- package/dist/types/Primitive/symbol/index.d.ts +5 -5
- package/dist/types/Primitive/tuple/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/tuple/Registry.d.ts +2 -2
- package/dist/types/Primitive/tuple/Schema.d.ts +5 -5
- package/dist/types/Primitive/tuple/Types.d.ts +4 -4
- package/dist/types/Primitive/tuple/index.d.ts +5 -5
- package/dist/types/Primitive/undefinable/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/undefinable/Registry.d.ts +2 -2
- package/dist/types/Primitive/undefinable/Schema.d.ts +6 -6
- package/dist/types/Primitive/undefinable/Types.d.ts +5 -5
- package/dist/types/Primitive/undefinable/index.d.ts +6 -6
- package/dist/types/Primitive/undefined/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/undefined/Registry.d.ts +1 -1
- package/dist/types/Primitive/undefined/Schema.d.ts +4 -4
- package/dist/types/Primitive/undefined/Types.d.ts +2 -2
- package/dist/types/Primitive/undefined/index.d.ts +5 -5
- package/dist/types/Primitive/unique/Registry.d.ts +39 -0
- package/dist/types/Primitive/unique/index.d.ts +2 -0
- package/dist/types/Random/Generator/sfc32.d.ts +1 -1
- package/dist/types/Random/Types.d.ts +1 -1
- package/dist/types/Random/index.d.ts +1 -1
- package/dist/types/Schema/Core.d.ts +5 -5
- package/dist/types/Schema/Registry.d.ts +3 -3
- package/dist/types/Schema/Satisfies.d.ts +3 -3
- package/dist/types/Schema/Types.d.ts +5 -5
- package/dist/types/Types.d.ts +11 -2
- package/dist/types/Unique/Capacity.d.ts +29 -0
- package/dist/types/Unique/Distinct.d.ts +95 -0
- package/dist/types/Unique/Key.d.ts +29 -0
- package/dist/types/Unique/Override.d.ts +16 -0
- package/dist/types/Unique/Strategy.d.ts +135 -0
- package/dist/types/Utility/Core.d.ts +2 -2
- package/dist/types/Utility/DeepMerge.d.ts +2 -2
- package/dist/types/Utility/ShallowMerge.d.ts +2 -2
- package/dist/types/adapting.d.ts +3 -3
- package/dist/types/harnessing.d.ts +2 -2
- package/dist/types/index.d.ts +40 -27
- package/dist/types/internal.d.ts +16 -15
- package/package.json +2 -2
|
@@ -1,28 +1,74 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import type { Bound, InputBound } from "../../Bound";
|
|
3
|
-
import type { Distribution } from "../../Distribution";
|
|
4
|
-
import type { Produce } from "../../Random/Types";
|
|
5
|
-
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types";
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { AdmittedEnds, Bound, InputAdmittedEnds, InputBound } from "../../Bound.ts";
|
|
3
|
+
import type { Distribution } from "../../Distribution/index.ts";
|
|
4
|
+
import type { Produce } from "../../Random/Types.ts";
|
|
5
|
+
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types.ts";
|
|
6
|
+
import type { Redraws } from "../../Unique/Strategy.ts";
|
|
6
7
|
/**
|
|
7
8
|
* Call-site `{ min, max }` — scalars are inclusive. Either end may be omitted;
|
|
8
9
|
* a missing `min` is the earliest representable instant and a missing `max` the
|
|
9
|
-
* latest, the same span as a bare `T.date`.
|
|
10
|
+
* latest, the same span as a bare `T.date`. Either end may be epoch
|
|
11
|
+
* milliseconds (`Bound.ts`'s `toDateBound`), stored as a `Date`.
|
|
10
12
|
*/
|
|
11
13
|
export type InputWhereby = {
|
|
12
|
-
min?: InputBound<Date> | undefined;
|
|
13
|
-
max?: InputBound<Date> | undefined;
|
|
14
|
+
min?: InputBound<Date | number> | undefined;
|
|
15
|
+
max?: InputBound<Date | number> | undefined;
|
|
14
16
|
distribution?: Distribution | undefined;
|
|
15
17
|
};
|
|
18
|
+
/** `T.date.past.whereby`: `past` closes its upper end at the clock. */
|
|
19
|
+
export type InputPastWhereby = {
|
|
20
|
+
min?: InputBound<Date | number> | undefined;
|
|
21
|
+
distribution?: Distribution | undefined;
|
|
22
|
+
};
|
|
23
|
+
/** `T.date.future.whereby`: `future` closes its lower end at the clock. */
|
|
24
|
+
export type InputFutureWhereby = {
|
|
25
|
+
max?: InputBound<Date | number> | undefined;
|
|
26
|
+
distribution?: Distribution | undefined;
|
|
27
|
+
};
|
|
28
|
+
/** `T.unique.date`'s `.whereby` inputs: each plain one, plus {@link Redraws}. */
|
|
29
|
+
export type InputUniqueWhereby = InputWhereby & Redraws;
|
|
30
|
+
export type InputUniquePastWhereby = InputPastWhereby & Redraws;
|
|
31
|
+
export type InputUniqueFutureWhereby = InputFutureWhereby & Redraws;
|
|
16
32
|
/**
|
|
17
33
|
* Stored `{ min, max }` — each present end is a canonical {@link Bound}. An
|
|
18
34
|
* omitted end stays omitted (fabricate fills `Defaults.ts`'s `unboundedEpoch`;
|
|
19
35
|
* adapters forward only the ends that were named).
|
|
36
|
+
*
|
|
37
|
+
* `redraws` is set only through {@link InputUniqueWhereby} and its
|
|
38
|
+
* `past`/`future` forms.
|
|
20
39
|
*/
|
|
21
40
|
export type Whereby = {
|
|
22
41
|
min?: Bound<Date> | undefined;
|
|
23
42
|
max?: Bound<Date> | undefined;
|
|
24
43
|
distribution?: Distribution | undefined;
|
|
44
|
+
redraws?: number | undefined;
|
|
25
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* `.admits(...)`'s input: the ends an adapter states, widening what `whereby`
|
|
48
|
+
* draws. An end is replaced (epoch milliseconds convert as in `whereby`),
|
|
49
|
+
* `Infinity` (or `-Infinity` for `min`) states no limit, and an omitted end
|
|
50
|
+
* keeps what is admitted already.
|
|
51
|
+
*/
|
|
52
|
+
export type InputAdmits = InputAdmittedEnds<Date | number>;
|
|
53
|
+
/**
|
|
54
|
+
* `T.date.past`'s `.admits`: its upper end is the clock, unknown until a
|
|
55
|
+
* Fabricator is built, so only `min` can be widened.
|
|
56
|
+
*/
|
|
57
|
+
export type InputPastAdmits = Pick<InputAdmits, "min">;
|
|
58
|
+
/** `T.date.future`'s `.admits`: likewise, only `max`. */
|
|
59
|
+
export type InputFutureAdmits = Pick<InputAdmits, "max">;
|
|
60
|
+
/** The `.admits` input a date schema of `$Meta` takes, by its `mode`. */
|
|
61
|
+
export type InputAdmitsOf<$Meta extends Meta> = $Meta extends {
|
|
62
|
+
mode: "past";
|
|
63
|
+
} ? InputPastAdmits : InputAdmitsOfFuture<$Meta>;
|
|
64
|
+
type InputAdmitsOfFuture<$Meta extends Meta> = $Meta extends {
|
|
65
|
+
mode: "future";
|
|
66
|
+
} ? InputFutureAdmits : InputAdmits;
|
|
67
|
+
/**
|
|
68
|
+
* `[Meta].admits`, set only by `.admits(...)` and complete once set: an absent
|
|
69
|
+
* end states no limit (`Admits.ts`'s `toAdmits`).
|
|
70
|
+
*/
|
|
71
|
+
export type Admits = AdmittedEnds<Date>;
|
|
26
72
|
export type Fabricated = Date;
|
|
27
73
|
/**
|
|
28
74
|
* A range/distribution (`whereby`, absent for the full-range bare form),
|
|
@@ -34,6 +80,8 @@ export type Fabricated = Date;
|
|
|
34
80
|
export type Meta = {
|
|
35
81
|
mode?: "past" | "future";
|
|
36
82
|
whereby?: Whereby;
|
|
83
|
+
unique?: true;
|
|
84
|
+
admits?: Admits | undefined;
|
|
37
85
|
produce?: Produce<Fabricated>;
|
|
38
86
|
};
|
|
39
87
|
export type Core<$Meta extends Meta = Meta, $Adaptations extends Adaptations = {}> = {
|
|
@@ -42,3 +90,4 @@ export type Core<$Meta extends Meta = Meta, $Adaptations extends Adaptations = {
|
|
|
42
90
|
readonly [Produces]?: Produced<Fabricated>;
|
|
43
91
|
readonly [Adaptation]?: $Adaptations;
|
|
44
92
|
};
|
|
93
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./Types";
|
|
2
|
-
export * from "./Schema";
|
|
3
|
-
export * from "./Fabricator";
|
|
4
|
-
export * from "./Registry";
|
|
5
|
-
export { default } from "./Registry";
|
|
1
|
+
export * from "./Types.ts";
|
|
2
|
+
export * from "./Schema.ts";
|
|
3
|
+
export * from "./Fabricator.ts";
|
|
4
|
+
export * from "./Registry.ts";
|
|
5
|
+
export { default } from "./Registry.ts";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { AdaptationsOf } from "../../Adapter/Types";
|
|
2
|
-
import type { FabricatorContext, NaiveFabricator } from "../../Fabricator/Types";
|
|
3
|
-
import type { Trace } from "../../Random/Types";
|
|
4
|
-
import { Children, Kind, Meta, type Adaptation } from "../../Types";
|
|
5
|
-
import type { Fabricated as FromValues } from "../tuple/Types";
|
|
6
|
-
import { Schema } from "./Schema";
|
|
7
|
-
import type { From, Meta as ThisMeta, Resolved, Source } from "./Types";
|
|
1
|
+
import type { AdaptationsOf } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { FabricatorContext, NaiveFabricator } from "../../Fabricator/Types.ts";
|
|
3
|
+
import type { Trace } from "../../Random/Types.ts";
|
|
4
|
+
import { Children, Kind, Meta, type Adaptation } from "../../Types.ts";
|
|
5
|
+
import type { Fabricated as FromValues } from "../tuple/Types.ts";
|
|
6
|
+
import { Schema } from "./Schema.ts";
|
|
7
|
+
import type { From, Meta as ThisMeta, Resolved, Source } from "./Types.ts";
|
|
8
8
|
export type Fabrication<$Fabricator extends Fabricator> = $Fabricator extends Fabricator<infer $Schema extends {
|
|
9
9
|
[Meta]: ThisMeta;
|
|
10
10
|
}> ? Resolved<$Schema[typeof Meta]["to"]> : never;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Deriver } from "./Schema";
|
|
2
|
-
import type { From, Source } from "./Types";
|
|
1
|
+
import { type Deriver } from "./Schema.ts";
|
|
2
|
+
import type { From, Source } from "./Types.ts";
|
|
3
3
|
export default function <const $From extends From, const $To extends Source>({ to, from, }: {
|
|
4
4
|
to: $To;
|
|
5
5
|
from: $From;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type AdaptationEntry } from "../../Adapter/Core";
|
|
2
|
-
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types";
|
|
3
|
-
import type { ProduceContext } from "../../Random/Types";
|
|
4
|
-
import { type SatisfiesThis } from "../../Schema/Satisfies";
|
|
5
|
-
import type * as tuple from "../tuple/Types";
|
|
6
|
-
import type { Core, From, Resolved, Source } from "./Types";
|
|
1
|
+
import { type AdaptationEntry } from "../../Adapter/Core.ts";
|
|
2
|
+
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types.ts";
|
|
3
|
+
import type { ProduceContext } from "../../Random/Types.ts";
|
|
4
|
+
import { type SatisfiesThis } from "../../Schema/Satisfies.ts";
|
|
5
|
+
import type * as tuple from "../tuple/Types.ts";
|
|
6
|
+
import type { Core, From, Resolved, Source } from "./Types.ts";
|
|
7
7
|
/**
|
|
8
8
|
* What `T.derive({ to, from })` returns: not yet a Schema — `.as(resolve)` is
|
|
9
9
|
* what produces one, matching `compute(source).as(resolve)`. There is no
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import type { ProduceContext } from "../../Random/Types";
|
|
3
|
-
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types";
|
|
4
|
-
import type { Resolved, Source } from "../object/compute/Types";
|
|
5
|
-
import type * as tuple from "../tuple/Types";
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { ProduceContext } from "../../Random/Types.ts";
|
|
3
|
+
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types.ts";
|
|
4
|
+
import type { Resolved, Source } from "../object/compute/Types.ts";
|
|
5
|
+
import type * as tuple from "../tuple/Types.ts";
|
|
6
6
|
/**
|
|
7
7
|
* `from` is a tuple of schemas, one per input slot — the same shape
|
|
8
8
|
* `tuple.Items` already is, so `tuple.Fabricated` can type `resolve`'s `values`
|
|
@@ -13,7 +13,7 @@ export type From = tuple.Items;
|
|
|
13
13
|
* Re-exported so this kind's other files (and `Primitive.derive.Source`) name
|
|
14
14
|
* the same `to` contract `object.compute` uses, rather than restating it.
|
|
15
15
|
*/
|
|
16
|
-
export type { Denoted, Resolved, Source } from "../object/compute/Types";
|
|
16
|
+
export type { Denoted, Resolved, Source } from "../object/compute/Types.ts";
|
|
17
17
|
/**
|
|
18
18
|
* `from` is stored after `toSchema` (inert per-slot schemas, same as `tuple`).
|
|
19
19
|
* `to` is stored exactly as given, whether a Schema or a builder, so its
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./Types";
|
|
2
|
-
export * from "./Schema";
|
|
3
|
-
export * from "./Fabricator";
|
|
4
|
-
export * from "./Registry";
|
|
5
|
-
export { default } from "./Registry";
|
|
1
|
+
export * from "./Types.ts";
|
|
2
|
+
export * from "./Schema.ts";
|
|
3
|
+
export * from "./Fabricator.ts";
|
|
4
|
+
export * from "./Registry.ts";
|
|
5
|
+
export { default } from "./Registry.ts";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AdaptationsOf } from "../../Adapter/Types";
|
|
2
|
-
import type { FabricatorContext, NaiveFabricator } from "../../Fabricator/Types";
|
|
3
|
-
import type { Trace } from "../../Random/Types";
|
|
4
|
-
import { Kind, Meta, type Adaptation } from "../../Types";
|
|
5
|
-
import { Schema } from "./Schema";
|
|
6
|
-
import type { Fabricated, Items, Meta as ThisMeta } from "./Types";
|
|
1
|
+
import type { AdaptationsOf } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { FabricatorContext, NaiveFabricator } from "../../Fabricator/Types.ts";
|
|
3
|
+
import type { Trace } from "../../Random/Types.ts";
|
|
4
|
+
import { Claim, Kind, Meta, type Adaptation } from "../../Types.ts";
|
|
5
|
+
import { Schema } from "./Schema.ts";
|
|
6
|
+
import type { Fabricated, Items, Meta as ThisMeta } from "./Types.ts";
|
|
7
7
|
export type Fabrication<$Fabricator extends Fabricator> = $Fabricator extends Fabricator<infer $Schema> ? Fabricated<$Schema[typeof Meta]["items"]> : never;
|
|
8
8
|
export type Fabricator<$Schema extends {
|
|
9
9
|
[Meta]: ThisMeta;
|
|
@@ -14,6 +14,8 @@ export type Fabricator<$Schema extends {
|
|
|
14
14
|
[Meta]: $Schema[typeof Meta];
|
|
15
15
|
readonly trace: Trace;
|
|
16
16
|
readonly [Adaptation]?: AdaptationsOf<$Schema>;
|
|
17
|
+
/** Present on a `T.unique.enum` only — see `Types.ts`'s `Claim`. */
|
|
18
|
+
readonly [Claim]?: (value: unknown) => void;
|
|
17
19
|
schema: Schema<$Schema[typeof Meta]["items"], AdaptationsOf<$Schema>>;
|
|
18
20
|
};
|
|
19
21
|
export declare function Fabricator<$Items extends Items>(context: FabricatorContext<Schema<$Items>>): Fabricator<Schema<$Items>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from "./Schema";
|
|
2
|
-
import type { Item, Items } from "./Types";
|
|
1
|
+
import { Schema } from "./Schema.ts";
|
|
2
|
+
import type { Item, Items } from "./Types.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Tuple-preserving: a mapped type over `$Items` keeps its exact length and
|
|
5
5
|
* per-position member types (`{ [K in keyof $Items]: ... }` walks a tuple
|
|
@@ -43,7 +43,27 @@ declare const _default: {
|
|
|
43
43
|
* Relative probability across members, given as `[weight, item]` pairs — the
|
|
44
44
|
* same tuple shape `weighted()` (`Distribution/index.ts`) itself accepts, not
|
|
45
45
|
* an object keyed by member.
|
|
46
|
+
*
|
|
47
|
+
* Widened back to `$Items`: the `NonEmpty<$Items>` intersection is only a
|
|
48
|
+
* call-site guard, and left in place it would leak into the Schema's type.
|
|
46
49
|
*/
|
|
47
50
|
weighted: <const $Items extends Items>(items: $Items & NonEmpty<$Items>) => Schema<$Items>;
|
|
48
51
|
};
|
|
49
52
|
export default _default;
|
|
53
|
+
/**
|
|
54
|
+
* `T.unique.enum`, assembled into the namespace by `Primitive/unique`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const unique: {
|
|
57
|
+
/**
|
|
58
|
+
* Equal probability across the members the built Fabricator has not yet
|
|
59
|
+
* produced: it never repeats a member, and the draw after the last throws
|
|
60
|
+
* `UniqueExhaustedError`.
|
|
61
|
+
*/
|
|
62
|
+
uniform: <const $Items extends ReadonlyArray<Item>>(items: $Items & NonEmpty<$Items>) => Schema<Weighted<$Items>>;
|
|
63
|
+
/**
|
|
64
|
+
* Relative probability across the members the built Fabricator has not yet
|
|
65
|
+
* produced, given as `[weight, item]` pairs: it never repeats a member, and
|
|
66
|
+
* the draw after the last throws `UniqueExhaustedError`.
|
|
67
|
+
*/
|
|
68
|
+
weighted: <const $Items extends Items>(items: $Items & NonEmpty<$Items>) => Schema<$Items>;
|
|
69
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type AdaptationEntry } from "../../Adapter/Core";
|
|
2
|
-
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types";
|
|
3
|
-
import type { Produce } from "../../Random/Types";
|
|
4
|
-
import { type SatisfiesThis } from "../../Schema/Satisfies";
|
|
5
|
-
import type { Core, Fabricated, Items } from "./Types";
|
|
1
|
+
import { type AdaptationEntry } from "../../Adapter/Core.ts";
|
|
2
|
+
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types.ts";
|
|
3
|
+
import type { Produce } from "../../Random/Types.ts";
|
|
4
|
+
import { type SatisfiesThis } from "../../Schema/Satisfies.ts";
|
|
5
|
+
import type { Core, Fabricated, Items } from "./Types.ts";
|
|
6
6
|
/**
|
|
7
7
|
* The buildable recipe for an `enum`: a weighted set of member values, one of
|
|
8
8
|
* which is drawn each fabrication. There is no bare form — see `Registry.ts`'s
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import type { Produce } from "../../Random/Types";
|
|
3
|
-
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types";
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { Produce } from "../../Random/Types.ts";
|
|
3
|
+
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types.ts";
|
|
4
4
|
/**
|
|
5
5
|
* The values an `enum` can draw from — any value at all, for the same reason
|
|
6
6
|
* `always.Value` is unconstrained (see its doc).
|
|
@@ -29,10 +29,15 @@ export type Fabricated<$Items extends Items = Items> = $Items[number][1];
|
|
|
29
29
|
* to fabricate from. `produce` layers an opaque production via `.as()`, carried
|
|
30
30
|
* alongside `items` rather than replacing it, so a prior member set survives
|
|
31
31
|
* `.as()` for future validation.
|
|
32
|
+
*
|
|
33
|
+
* `unique` is set by `T.unique.enum`: the built Fabricator draws its members
|
|
34
|
+
* without replacement for its whole lifetime (`Unique/Strategy.ts`'s
|
|
35
|
+
* `exactValues`). `produce` still wins over it, as over everything else.
|
|
32
36
|
*/
|
|
33
37
|
export type Meta<$Items extends Items = Items> = {
|
|
34
38
|
items: $Items;
|
|
35
39
|
produce?: Produce<Fabricated<$Items>>;
|
|
40
|
+
unique?: true;
|
|
36
41
|
};
|
|
37
42
|
export type Core<$Items extends Items = Items, $Adaptations extends Adaptations = {}> = {
|
|
38
43
|
[Kind]: "enum";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./Types";
|
|
2
|
-
export * from "./Schema";
|
|
3
|
-
export * from "./Fabricator";
|
|
4
|
-
export * from "./Registry";
|
|
5
|
-
export { default } from "./Registry";
|
|
1
|
+
export * from "./Types.ts";
|
|
2
|
+
export * from "./Schema.ts";
|
|
3
|
+
export * from "./Fabricator.ts";
|
|
4
|
+
export * from "./Registry.ts";
|
|
5
|
+
export { default } from "./Registry.ts";
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { Kind } from "../Types";
|
|
2
|
-
import * as Primitive from "./namespace";
|
|
3
|
-
export { default as always } from "./always";
|
|
4
|
-
export { default as array } from "./array";
|
|
5
|
-
export { default as bigint } from "./bigint";
|
|
6
|
-
export { default as boolean } from "./boolean";
|
|
7
|
-
export { default as choice } from "./choice";
|
|
8
|
-
export { default as date } from "./date";
|
|
9
|
-
export { default as derive } from "./derive";
|
|
10
|
-
export { default as enum } from "./enum";
|
|
11
|
-
export { default as null } from "./null";
|
|
12
|
-
export { default as nullable } from "./nullable";
|
|
13
|
-
export { default as nullish } from "./nullish";
|
|
14
|
-
export { default as number } from "./number";
|
|
15
|
-
export { default as object } from "./object";
|
|
16
|
-
export { default as omit } from "./object/omit";
|
|
17
|
-
export { default as omittable } from "./object/omittable";
|
|
18
|
-
export { default as optional } from "./object/optional";
|
|
19
|
-
export { default as pick } from "./object/pick";
|
|
20
|
-
export { default as opaque } from "./opaque";
|
|
21
|
-
export { default as record } from "./record";
|
|
22
|
-
export { default as recursive } from "./recursive";
|
|
23
|
-
export { default as string } from "./string";
|
|
24
|
-
export { default as symbol } from "./symbol";
|
|
25
|
-
export { default as tuple } from "./tuple";
|
|
26
|
-
export { default as undefinable } from "./undefinable";
|
|
27
|
-
export { default as
|
|
1
|
+
import { Kind } from "../Types.ts";
|
|
2
|
+
import * as Primitive from "./namespace.ts";
|
|
3
|
+
export { default as always } from "./always/index.ts";
|
|
4
|
+
export { default as array } from "./array/index.ts";
|
|
5
|
+
export { default as bigint } from "./bigint/index.ts";
|
|
6
|
+
export { default as boolean } from "./boolean/index.ts";
|
|
7
|
+
export { default as choice } from "./choice/index.ts";
|
|
8
|
+
export { default as date } from "./date/index.ts";
|
|
9
|
+
export { default as derive } from "./derive/index.ts";
|
|
10
|
+
export { default as enum } from "./enum/index.ts";
|
|
11
|
+
export { default as null } from "./null/index.ts";
|
|
12
|
+
export { default as nullable } from "./nullable/index.ts";
|
|
13
|
+
export { default as nullish } from "./nullish/index.ts";
|
|
14
|
+
export { default as number } from "./number/index.ts";
|
|
15
|
+
export { default as object } from "./object/index.ts";
|
|
16
|
+
export { default as omit } from "./object/omit/index.ts";
|
|
17
|
+
export { default as omittable } from "./object/omittable/index.ts";
|
|
18
|
+
export { default as optional } from "./object/optional/index.ts";
|
|
19
|
+
export { default as pick } from "./object/pick/index.ts";
|
|
20
|
+
export { default as opaque } from "./opaque/index.ts";
|
|
21
|
+
export { default as record } from "./record/index.ts";
|
|
22
|
+
export { default as recursive } from "./recursive/index.ts";
|
|
23
|
+
export { default as string } from "./string/index.ts";
|
|
24
|
+
export { default as symbol } from "./symbol/index.ts";
|
|
25
|
+
export { default as tuple } from "./tuple/index.ts";
|
|
26
|
+
export { default as undefinable } from "./undefinable/index.ts";
|
|
27
|
+
export { default as unique } from "./unique/index.ts";
|
|
28
|
+
export { default as undefined } from "./undefined/index.ts";
|
|
28
29
|
export { Primitive };
|
|
29
30
|
export type Fabricator = Primitive.always.Fabricator<any> | Primitive.array.Fabricator<any> | Primitive.bigint.Fabricator | Primitive.boolean.Fabricator | Primitive.choice.Fabricator<any> | Primitive.date.Fabricator | Primitive.derive.Fabricator<any> | Primitive.enum.Fabricator<any> | Primitive.null.Fabricator | Primitive.nullable.Fabricator<any> | Primitive.nullish.Fabricator<any> | Primitive.number.Fabricator | Primitive.object.Fabricator<any> | Primitive.object.compute.Fabricator<any, any> | Primitive.object.omittable.Fabricator<any> | Primitive.object.optional.Fabricator<any> | Primitive.opaque.Fabricator<any> | Primitive.record.Fabricator<any> | Primitive.recursive.Fabricator<any> | Primitive.recursive.self.Fabricator<any> | Primitive.string.Fabricator | Primitive.symbol.Fabricator | Primitive.tuple.Fabricator<any> | Primitive.undefined.Fabricator | Primitive.undefinable.Fabricator<any>;
|
|
30
31
|
export type Schema = Primitive.always.Schema<any> | Primitive.array.Schema<any> | Primitive.bigint.Schema | Primitive.boolean.Schema | Primitive.choice.Schema<any> | Primitive.date.Schema | Primitive.derive.Schema<any, any> | Primitive.enum.Schema<any> | Primitive.null.Schema | Primitive.nullable.Schema<any> | Primitive.nullish.Schema<any> | Primitive.number.Schema | Primitive.object.Schema<any> | Primitive.object.compute.Schema<any, any> | Primitive.object.omittable.Schema<any> | Primitive.object.optional.Schema<any> | Primitive.opaque.Schema<any> | Primitive.record.Schema<any, any> | Primitive.recursive.Schema<any> | Primitive.recursive.self.Schema<any> | Primitive.string.Schema | Primitive.symbol.Schema | Primitive.tuple.Schema<any> | Primitive.undefined.Schema | Primitive.undefinable.Schema<any>;
|
|
@@ -16,24 +16,24 @@
|
|
|
16
16
|
* `@ghostry/fabricator/internal`). Do not add this object to the registry:
|
|
17
17
|
* `T.Primitive` is not a builder.
|
|
18
18
|
*/
|
|
19
|
-
export * as always from "./always";
|
|
20
|
-
export * as array from "./array";
|
|
21
|
-
export * as bigint from "./bigint";
|
|
22
|
-
export * as boolean from "./boolean";
|
|
23
|
-
export * as choice from "./choice";
|
|
24
|
-
export * as date from "./date";
|
|
25
|
-
export * as derive from "./derive";
|
|
26
|
-
export * as enum from "./enum";
|
|
27
|
-
export * as null from "./null";
|
|
28
|
-
export * as nullable from "./nullable";
|
|
29
|
-
export * as nullish from "./nullish";
|
|
30
|
-
export * as number from "./number";
|
|
31
|
-
export * as object from "./object";
|
|
32
|
-
export * as opaque from "./opaque";
|
|
33
|
-
export * as record from "./record";
|
|
34
|
-
export * as recursive from "./recursive";
|
|
35
|
-
export * as string from "./string";
|
|
36
|
-
export * as symbol from "./symbol";
|
|
37
|
-
export * as tuple from "./tuple";
|
|
38
|
-
export * as undefinable from "./undefinable";
|
|
39
|
-
export * as undefined from "./undefined";
|
|
19
|
+
export * as always from "./always/index.ts";
|
|
20
|
+
export * as array from "./array/index.ts";
|
|
21
|
+
export * as bigint from "./bigint/index.ts";
|
|
22
|
+
export * as boolean from "./boolean/index.ts";
|
|
23
|
+
export * as choice from "./choice/index.ts";
|
|
24
|
+
export * as date from "./date/index.ts";
|
|
25
|
+
export * as derive from "./derive/index.ts";
|
|
26
|
+
export * as enum from "./enum/index.ts";
|
|
27
|
+
export * as null from "./null/index.ts";
|
|
28
|
+
export * as nullable from "./nullable/index.ts";
|
|
29
|
+
export * as nullish from "./nullish/index.ts";
|
|
30
|
+
export * as number from "./number/index.ts";
|
|
31
|
+
export * as object from "./object/index.ts";
|
|
32
|
+
export * as opaque from "./opaque/index.ts";
|
|
33
|
+
export * as record from "./record/index.ts";
|
|
34
|
+
export * as recursive from "./recursive/index.ts";
|
|
35
|
+
export * as string from "./string/index.ts";
|
|
36
|
+
export * as symbol from "./symbol/index.ts";
|
|
37
|
+
export * as tuple from "./tuple/index.ts";
|
|
38
|
+
export * as undefinable from "./undefinable/index.ts";
|
|
39
|
+
export * as undefined from "./undefined/index.ts";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AdaptationsOf } from "../../Adapter/Types";
|
|
2
|
-
import type { FabricatorContext, NaiveFabricator } from "../../Fabricator/Types";
|
|
3
|
-
import type { Trace } from "../../Random/Types";
|
|
4
|
-
import { Kind, Meta, type Adaptation } from "../../Types";
|
|
5
|
-
import { Schema } from "./Schema";
|
|
6
|
-
import type { Fabricated, Meta as ThisMeta } from "./Types";
|
|
1
|
+
import type { AdaptationsOf } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { FabricatorContext, NaiveFabricator } from "../../Fabricator/Types.ts";
|
|
3
|
+
import type { Trace } from "../../Random/Types.ts";
|
|
4
|
+
import { Kind, Meta, type Adaptation } from "../../Types.ts";
|
|
5
|
+
import { Schema } from "./Schema.ts";
|
|
6
|
+
import type { Fabricated, Meta as ThisMeta } from "./Types.ts";
|
|
7
7
|
export type Fabrication<_ extends Fabricator> = Fabricated;
|
|
8
8
|
export type Fabricator<$Schema extends {
|
|
9
9
|
[Meta]: ThisMeta;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type AdaptationEntry } from "../../Adapter/Core";
|
|
2
|
-
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types";
|
|
3
|
-
import { type SatisfiesThis } from "../../Schema/Satisfies";
|
|
4
|
-
import type { Core, Fabricated, Meta as ThisMeta } from "./Types";
|
|
1
|
+
import { type AdaptationEntry } from "../../Adapter/Core.ts";
|
|
2
|
+
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types.ts";
|
|
3
|
+
import { type SatisfiesThis } from "../../Schema/Satisfies.ts";
|
|
4
|
+
import type { Core, Fabricated, Meta as ThisMeta } from "./Types.ts";
|
|
5
5
|
/**
|
|
6
6
|
* Nothing to configure (see `Types.ts`'s `Meta`), so `adapt` is this kind's
|
|
7
7
|
* only mapping method — an external library that spells "null" differently
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types";
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types.ts";
|
|
3
3
|
export type Fabricated = null;
|
|
4
4
|
/**
|
|
5
5
|
* Nothing to configure: `null` has exactly one possible value, so there is no
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./Fabricator";
|
|
2
|
-
export * from "./Registry";
|
|
3
|
-
export { default } from "./Registry";
|
|
4
|
-
export * from "./Schema";
|
|
5
|
-
export * from "./Types";
|
|
1
|
+
export * from "./Fabricator.ts";
|
|
2
|
+
export * from "./Registry.ts";
|
|
3
|
+
export { default } from "./Registry.ts";
|
|
4
|
+
export * from "./Schema.ts";
|
|
5
|
+
export * from "./Types.ts";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AdaptationsOf } from "../../Adapter/Types";
|
|
2
|
-
import type { Fabricator as BaseFabricator, FabricatorContext } from "../../Fabricator/Types";
|
|
3
|
-
import type { Trace } from "../../Random/Types";
|
|
4
|
-
import { Children, Kind, Meta, type Adaptation } from "../../Types";
|
|
5
|
-
import { Schema } from "./Schema";
|
|
6
|
-
import type { Definition, Fabricated, Meta as ThisMeta } from "./Types";
|
|
1
|
+
import type { AdaptationsOf } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { Fabricator as BaseFabricator, FabricatorContext } from "../../Fabricator/Types.ts";
|
|
3
|
+
import type { Trace } from "../../Random/Types.ts";
|
|
4
|
+
import { Children, Kind, Meta, type Adaptation } from "../../Types.ts";
|
|
5
|
+
import { Schema } from "./Schema.ts";
|
|
6
|
+
import type { Definition, Fabricated, Meta as ThisMeta } from "./Types.ts";
|
|
7
7
|
export type Fabrication<$Fabricator extends Fabricator> = $Fabricator extends Fabricator<infer $Schema> ? Fabricated<$Schema[typeof Meta]["definition"]> : never;
|
|
8
8
|
export type Fabricator<$Schema extends {
|
|
9
9
|
[Meta]: ThisMeta;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Schema } from "./Schema";
|
|
2
|
-
import type { Definition } from "./Types";
|
|
1
|
+
import { Schema } from "./Schema.ts";
|
|
2
|
+
import type { Definition } from "./Types.ts";
|
|
3
3
|
export default function <const $Definition extends Definition>(definition: $Definition): Schema<$Definition>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type AdaptationEntry } from "../../Adapter/Core";
|
|
2
|
-
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types";
|
|
3
|
-
import type { Produce } from "../../Random/Types";
|
|
4
|
-
import { type SatisfiesThis } from "../../Schema/Satisfies";
|
|
5
|
-
import type { AnySchema } from "../../Schema/Types";
|
|
6
|
-
import type { Core, Definition, Fabricated, Weights } from "./Types";
|
|
1
|
+
import { type AdaptationEntry } from "../../Adapter/Core.ts";
|
|
2
|
+
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types.ts";
|
|
3
|
+
import type { Produce } from "../../Random/Types.ts";
|
|
4
|
+
import { type SatisfiesThis } from "../../Schema/Satisfies.ts";
|
|
5
|
+
import type { AnySchema } from "../../Schema/Types.ts";
|
|
6
|
+
import type { Core, Definition, Fabricated, Weights } from "./Types.ts";
|
|
7
7
|
/**
|
|
8
8
|
* The buildable recipe for a `nullable`: a single wrapped Schema, drawn (or
|
|
9
9
|
* not) each fabrication.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import type { Produce } from "../../Random/Types";
|
|
3
|
-
import type { AnySchema, Fabricated as FabricatedBy } from "../../Schema/Types";
|
|
4
|
-
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types";
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { Produce } from "../../Random/Types.ts";
|
|
3
|
+
import type { AnySchema, Fabricated as FabricatedBy } from "../../Schema/Types.ts";
|
|
4
|
+
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types.ts";
|
|
5
5
|
/** The wrapped schema — the value type produced when the roll isn't `null`. */
|
|
6
6
|
export type Definition = AnySchema;
|
|
7
7
|
export type Fabricated<$Definition extends Definition, $Bindings extends unknown[] = []> = FabricatedBy<$Definition, $Bindings> | null;
|
|
8
|
-
export type { Outcome } from "./Outcomes";
|
|
8
|
+
export type { Outcome } from "./Outcomes.ts";
|
|
9
9
|
/**
|
|
10
10
|
* Relative weights for `.weighted(...)`, keyed by `Outcome`. Keys optional — an
|
|
11
11
|
* omitted key falls back to baseline `1`, the same weight the 50/50 split
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./Fabricator";
|
|
2
|
-
export * from "./Outcomes";
|
|
3
|
-
export * from "./Registry";
|
|
4
|
-
export { default } from "./Registry";
|
|
5
|
-
export * from "./Schema";
|
|
6
|
-
export * from "./Types";
|
|
1
|
+
export * from "./Fabricator.ts";
|
|
2
|
+
export * from "./Outcomes.ts";
|
|
3
|
+
export * from "./Registry.ts";
|
|
4
|
+
export { default } from "./Registry.ts";
|
|
5
|
+
export * from "./Schema.ts";
|
|
6
|
+
export * from "./Types.ts";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AdaptationsOf } from "../../Adapter/Types";
|
|
2
|
-
import type { Fabricator as BaseFabricator, FabricatorContext } from "../../Fabricator/Types";
|
|
3
|
-
import type { Trace } from "../../Random/Types";
|
|
4
|
-
import { Children, Kind, Meta, type Adaptation } from "../../Types";
|
|
5
|
-
import { Schema } from "./Schema";
|
|
6
|
-
import type { Definition, Fabricated, Meta as ThisMeta } from "./Types";
|
|
1
|
+
import type { AdaptationsOf } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { Fabricator as BaseFabricator, FabricatorContext } from "../../Fabricator/Types.ts";
|
|
3
|
+
import type { Trace } from "../../Random/Types.ts";
|
|
4
|
+
import { Children, Kind, Meta, type Adaptation } from "../../Types.ts";
|
|
5
|
+
import { Schema } from "./Schema.ts";
|
|
6
|
+
import type { Definition, Fabricated, Meta as ThisMeta } from "./Types.ts";
|
|
7
7
|
export type Fabrication<$Fabricator extends Fabricator> = $Fabricator extends Fabricator<infer $Schema> ? Fabricated<$Schema[typeof Meta]["definition"]> : never;
|
|
8
8
|
export type Fabricator<$Schema extends {
|
|
9
9
|
[Meta]: ThisMeta;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Schema } from "./Schema";
|
|
2
|
-
import type { Definition } from "./Types";
|
|
1
|
+
import { Schema } from "./Schema.ts";
|
|
2
|
+
import type { Definition } from "./Types.ts";
|
|
3
3
|
export default function <const $Definition extends Definition>(definition: $Definition): Schema<$Definition>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type AdaptationEntry } from "../../Adapter/Core";
|
|
2
|
-
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types";
|
|
3
|
-
import type { Produce } from "../../Random/Types";
|
|
4
|
-
import { type SatisfiesThis } from "../../Schema/Satisfies";
|
|
5
|
-
import type { AnySchema } from "../../Schema/Types";
|
|
6
|
-
import type { Core, Definition, Fabricated, Weights } from "./Types";
|
|
1
|
+
import { type AdaptationEntry } from "../../Adapter/Core.ts";
|
|
2
|
+
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../Adapter/Types.ts";
|
|
3
|
+
import type { Produce } from "../../Random/Types.ts";
|
|
4
|
+
import { type SatisfiesThis } from "../../Schema/Satisfies.ts";
|
|
5
|
+
import type { AnySchema } from "../../Schema/Types.ts";
|
|
6
|
+
import type { Core, Definition, Fabricated, Weights } from "./Types.ts";
|
|
7
7
|
/**
|
|
8
8
|
* The buildable recipe for a `nullish`: a single wrapped Schema, drawn (or not)
|
|
9
9
|
* each fabrication.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import type { Produce } from "../../Random/Types";
|
|
3
|
-
import type { AnySchema, Fabricated as FabricatedBy } from "../../Schema/Types";
|
|
4
|
-
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types";
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import type { Produce } from "../../Random/Types.ts";
|
|
3
|
+
import type { AnySchema, Fabricated as FabricatedBy } from "../../Schema/Types.ts";
|
|
4
|
+
import type { Adaptation, Kind, Meta, Produced, Produces } from "../../Types.ts";
|
|
5
5
|
/**
|
|
6
6
|
* The wrapped schema — the value type produced when the roll lands on neither
|
|
7
7
|
* `null` nor `undefined`.
|
|
8
8
|
*/
|
|
9
9
|
export type Definition = AnySchema;
|
|
10
10
|
export type Fabricated<$Definition extends Definition, $Bindings extends unknown[] = []> = FabricatedBy<$Definition, $Bindings> | null | undefined;
|
|
11
|
-
export type { Outcome } from "./Outcomes";
|
|
11
|
+
export type { Outcome } from "./Outcomes.ts";
|
|
12
12
|
/**
|
|
13
13
|
* Relative weights for `.weighted(...)`, keyed by `Outcome`. Keys optional — an
|
|
14
14
|
* omitted key falls back to baseline `1`, the same weight the uniform 1/3 split
|