@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,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";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Admits, InputAdmits, Meta } from "./Types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve `.admits(...)` against what is admitted already: `meta.admits`, or by
|
|
4
|
+
* default the `whereby` ends — what an adapter states without one. An omitted
|
|
5
|
+
* `whereby` end draws against `±Number.MAX_VALUE` (`±MAX_SAFE_INTEGER` for an
|
|
6
|
+
* integer), so only no limit admits it. `multipleOf` is never checked
|
|
7
|
+
* (`Types.ts`'s `Keywords`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function toAdmits(meta: Meta, input: InputAdmits): Admits;
|
|
@@ -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 { Claim, 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;
|
|
@@ -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.number` only — see `Types.ts`'s `Claim`. */
|
|
18
|
+
readonly [Claim]?: (value: unknown) => void;
|
|
17
19
|
schema: Schema<$Schema[typeof Meta], AdaptationsOf<$Schema>>;
|
|
18
20
|
};
|
|
19
21
|
export declare function Fabricator(context: FabricatorContext<Schema>): Fabricator;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import { default as bigint } from "../bigint";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import { default as bigint } from "../bigint/index.ts";
|
|
3
|
+
import { unique as uniqueBigint } from "../bigint/Registry.ts";
|
|
4
|
+
import { Schema } from "./Schema.ts";
|
|
5
|
+
import type { InputUniqueWhereby, InputWhereby, Whereby } from "./Types.ts";
|
|
5
6
|
type ThisRegistry = Schema<{}, Adaptations> & {
|
|
6
7
|
/**
|
|
7
8
|
* A `number` drawn from `[min, max]`, either end optional. Pass a
|
|
@@ -39,3 +40,43 @@ type ThisRegistry = Schema<{}, Adaptations> & {
|
|
|
39
40
|
*/
|
|
40
41
|
declare function registry(): ThisRegistry;
|
|
41
42
|
export default registry;
|
|
43
|
+
type UniqueRegistry = Schema<{
|
|
44
|
+
unique: true;
|
|
45
|
+
}, Adaptations> & {
|
|
46
|
+
/**
|
|
47
|
+
* A `number` that the built Fabricator never repeats, drawn from `[min, max]`
|
|
48
|
+
* like `T.number.whereby`. Values are tracked as they are drawn, so memory
|
|
49
|
+
* grows with the values produced. A continuous range repeats only by chance,
|
|
50
|
+
* which makes this mostly a guard; a range whose ends meet holds one value,
|
|
51
|
+
* and the draw after it throws `UniqueExhaustedError`.
|
|
52
|
+
*/
|
|
53
|
+
whereby: (whereby: InputUniqueWhereby) => Schema<{
|
|
54
|
+
unique: true;
|
|
55
|
+
whereby: Whereby;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Integers the built Fabricator never repeats. A uniform range is drawn as a
|
|
59
|
+
* random permutation, so it yields every value exactly once and the draw
|
|
60
|
+
* after the last throws `UniqueExhaustedError`. A skewed or unbounded range
|
|
61
|
+
* is tracked instead, still exhausting exactly when bounded. A skewed range's
|
|
62
|
+
* rarest values can take many draws to find; `redraws` raises the cap on
|
|
63
|
+
* consecutive repeats for that.
|
|
64
|
+
*/
|
|
65
|
+
integer: Schema<{
|
|
66
|
+
integer: true;
|
|
67
|
+
unique: true;
|
|
68
|
+
}> & {
|
|
69
|
+
whereby: (whereby: InputUniqueWhereby) => Schema<{
|
|
70
|
+
integer: true;
|
|
71
|
+
unique: true;
|
|
72
|
+
whereby: Whereby;
|
|
73
|
+
}>;
|
|
74
|
+
big: typeof uniqueBigint;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* `T.unique.number`, assembled into the namespace by `Primitive/unique`, which
|
|
79
|
+
* installs it as a getter for the same reason `T.number` is one. Mirrors
|
|
80
|
+
* {@link registry} without `integer.sequence`, which already never repeats.
|
|
81
|
+
*/
|
|
82
|
+
export declare function unique(): UniqueRegistry;
|
|
@@ -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,
|
|
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, Meta as ThisMeta, Admits, InputAdmits } from "./Types.ts";
|
|
6
6
|
/**
|
|
7
7
|
* Buildable `number` recipe: a range/distribution (`whereby`, absent for the
|
|
8
8
|
* full-range bare form), `integer` for whole-number semantics, a `sequence`
|
|
@@ -22,7 +22,15 @@ export interface Schema<$Meta extends ThisMeta = ThisMeta, $Adaptations extends
|
|
|
22
22
|
* `.as(...)` (or future validation of `produce`) still has them to check
|
|
23
23
|
* against.
|
|
24
24
|
*/
|
|
25
|
-
as: (produce: Produce<Fabricated
|
|
25
|
+
as: (produce: Produce<Fabricated>) => Schema<$Meta, $Adaptations>;
|
|
26
|
+
/**
|
|
27
|
+
* State what adapters admit for this schema, widening what `whereby` draws —
|
|
28
|
+
* see `string/Schema.ts`'s `admits` for the full contract. An omitted
|
|
29
|
+
* `whereby` end is unbounded, so only no limit admits it.
|
|
30
|
+
*/
|
|
31
|
+
admits: (admitted: InputAdmits) => Schema<$Meta & {
|
|
32
|
+
admits: Admits;
|
|
33
|
+
}, $Adaptations>;
|
|
26
34
|
/**
|
|
27
35
|
* Check that this schema's fabricated value type is assignable to `$Target`.
|
|
28
36
|
* Identity at runtime; the target is not carried into later chained calls —
|
|
@@ -1,8 +1,9 @@
|
|
|
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 end is unbounded (the same policy as a bare `T.number`), not a
|
|
@@ -13,26 +14,42 @@ export type InputWhereby = {
|
|
|
13
14
|
max?: InputBound<number> | undefined;
|
|
14
15
|
distribution?: Distribution | undefined;
|
|
15
16
|
};
|
|
17
|
+
/** `T.unique.number`'s `.whereby`: the same input, plus {@link Redraws}. */
|
|
18
|
+
export type InputUniqueWhereby = InputWhereby & Redraws;
|
|
16
19
|
/**
|
|
17
20
|
* Stored `{ min, max }` — each present end is a canonical {@link Bound}. An
|
|
18
21
|
* omitted end stays omitted (fabricate fills the unbounded cap; adapters
|
|
19
|
-
* forward only the ends that were named).
|
|
22
|
+
* forward only the ends that were named). `redraws` is set only through
|
|
23
|
+
* {@link InputUniqueWhereby}.
|
|
20
24
|
*/
|
|
21
25
|
export type Whereby = {
|
|
22
26
|
min?: Bound<number> | undefined;
|
|
23
27
|
max?: Bound<number> | undefined;
|
|
24
28
|
distribution?: Distribution | undefined;
|
|
29
|
+
redraws?: number | undefined;
|
|
25
30
|
};
|
|
26
|
-
export type Fabricated = number;
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
+
* `.admits(...)`'s input: the ends an adapter states, widening what `whereby`
|
|
33
|
+
* draws. An end is replaced, `Infinity` (or `-Infinity` for `min`) states no
|
|
34
|
+
* limit, and an omitted end keeps what is admitted already.
|
|
35
|
+
*/
|
|
36
|
+
export type InputAdmits = InputAdmittedEnds<number> & Keywords;
|
|
37
|
+
/**
|
|
38
|
+
* JSON-Schema keywords for what the numbers are, which adapters forward to
|
|
39
|
+
* their target. Unlike an end, `multipleOf` is not checked against what is
|
|
40
|
+
* drawn — like `.adapt`, the caller vouches that fabricated values match,
|
|
41
|
+
* usually by fabricating through `.as(produce)`. A keyword left out keeps what
|
|
42
|
+
* is admitted already.
|
|
32
43
|
*/
|
|
33
|
-
export type
|
|
34
|
-
multipleOf?: number;
|
|
44
|
+
export type Keywords = {
|
|
45
|
+
multipleOf?: number | undefined;
|
|
35
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* `[Meta].admits`, set only by `.admits(...)` and complete once set: an absent
|
|
49
|
+
* end states no limit (`Admits.ts`'s `toAdmits`).
|
|
50
|
+
*/
|
|
51
|
+
export type Admits = AdmittedEnds<number> & Keywords;
|
|
52
|
+
export type Fabricated = number;
|
|
36
53
|
/**
|
|
37
54
|
* A ranged number — `whereby` is absent on the full-range form, `integer` (a
|
|
38
55
|
* literal, not widened to `boolean`) selects whole-number semantics, or a
|
|
@@ -40,12 +57,17 @@ export type JsonSchema = {
|
|
|
40
57
|
* counter only ever yields whole numbers), optionally overridden by an opaque
|
|
41
58
|
* `as` production — carried alongside the rest rather than replacing it, so a
|
|
42
59
|
* prior scoping survives `as` for future validation.
|
|
60
|
+
*
|
|
61
|
+
* `unique` is set by `T.unique.number`: the built Fabricator never repeats a
|
|
62
|
+
* value for its whole lifetime (`Unique/Distinct.ts`'s `toNumberStrategy`).
|
|
63
|
+
* Never paired with `sequence`, which cannot repeat by design.
|
|
43
64
|
*/
|
|
44
65
|
export type Meta = {
|
|
45
66
|
whereby?: Whereby;
|
|
46
67
|
integer?: boolean;
|
|
47
68
|
sequence?: boolean;
|
|
48
|
-
|
|
69
|
+
unique?: true;
|
|
70
|
+
admits?: Admits | undefined;
|
|
49
71
|
produce?: Produce<Fabricated>;
|
|
50
72
|
};
|
|
51
73
|
export type Core<$Meta extends Meta = Meta, $Adaptations extends Adaptations = {}> = {
|
|
@@ -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 { 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 type { Schema } from "./Schema";
|
|
6
|
-
import type { Definition, Fabricated, Override, 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 type { Schema } from "./Schema.ts";
|
|
6
|
+
import type { Definition, Fabricated, Override, 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,7 +1,7 @@
|
|
|
1
|
-
import type { Adaptations } from "../../Adapter/Types";
|
|
2
|
-
import { Adaptation, Meta } from "../../Types";
|
|
3
|
-
import { Schema } from "./Schema";
|
|
4
|
-
import type { Definition, Subsettable, Meta as ThisMeta } from "./Types";
|
|
1
|
+
import type { Adaptations } from "../../Adapter/Types.ts";
|
|
2
|
+
import { Adaptation, Meta } from "../../Types.ts";
|
|
3
|
+
import { Schema } from "./Schema.ts";
|
|
4
|
+
import type { Definition, Subsettable, Meta as ThisMeta } from "./Types.ts";
|
|
5
5
|
/**
|
|
6
6
|
* Rebuild a full `object` Schema — with `extend`/`refine` restored — from
|
|
7
7
|
* anything already reduced to this kind's `[Meta]` (a bare Schema, or a built
|
|
@@ -1,11 +1,11 @@
|
|
|
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 { ShallowMerge } from "../../Utility/ShallowMerge";
|
|
7
|
-
import type { Computer } from "./compute/Schema";
|
|
8
|
-
import type { Core, Definition, Extender, Fabricated, Override, Refinement } 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 { ShallowMerge } from "../../Utility/ShallowMerge.ts";
|
|
7
|
+
import type { Computer } from "./compute/Schema.ts";
|
|
8
|
+
import type { Core, Definition, Extender, Fabricated, Override, Refinement } from "./Types.ts";
|
|
9
9
|
export type Refiner<$Definition extends Definition, $Refinement extends Refinement<$Definition>> = (params: {
|
|
10
10
|
base: Schema<$Definition>;
|
|
11
11
|
compute: Computer<$Definition>;
|
|
@@ -1,9 +1,9 @@
|
|
|
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 { Kind, Meta, type Adaptation, type Omitted, type Produced, type Produces } from "../../Types";
|
|
5
|
-
import { type Pretty } from "../../Utility/Types";
|
|
6
|
-
import type { Schema as ComputeSchema } from "./compute/Schema";
|
|
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 { Kind, Meta, type Adaptation, type Omitted, type Produced, type Produces } from "../../Types.ts";
|
|
5
|
+
import { type Pretty } from "../../Utility/Types.ts";
|
|
6
|
+
import type { Schema as ComputeSchema } from "./compute/Schema.ts";
|
|
7
7
|
export type Definition<$Schema = AnySchema> = {
|
|
8
8
|
[_ in string]: $Schema;
|
|
9
9
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Adaptations } from "../../../Adapter/Types";
|
|
2
|
-
import type { Fabricator as BaseFabricator, FabricatorContext } from "../../../Fabricator/Types";
|
|
3
|
-
import type { Trace } from "../../../Random/Types";
|
|
4
|
-
import { Kind, Meta, type Adaptation } from "../../../Types";
|
|
5
|
-
import { type PlainObject } from "../../../Utility/Types";
|
|
6
|
-
import type { Schema } from "./Schema";
|
|
7
|
-
import type { Resolved, Source, Meta as ThisMeta } from "./Types";
|
|
1
|
+
import type { Adaptations } 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 { Kind, Meta, type Adaptation } from "../../../Types.ts";
|
|
5
|
+
import { type PlainObject } from "../../../Utility/Types.ts";
|
|
6
|
+
import type { Schema } from "./Schema.ts";
|
|
7
|
+
import type { Resolved, Source, Meta as ThisMeta } from "./Types.ts";
|
|
8
8
|
export type Fabrication<$Fabricator extends Fabricator<any, Source>> = $Fabricator extends Fabricator<any, infer $Source> ? Resolved<$Source> : never;
|
|
9
9
|
export type Fabricator<$Fabricated, $Source extends Source, $Adaptations extends Adaptations = {}> = {
|
|
10
10
|
[Kind]: "object.compute";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Definition } from "../Types";
|
|
2
|
-
import { type Computer } from "./Schema";
|
|
1
|
+
import type { Definition } from "../Types.ts";
|
|
2
|
+
import { type Computer } from "./Schema.ts";
|
|
3
3
|
/**
|
|
4
4
|
* `base` is the keys of the `.refine()` stage's base definition — what a plain
|
|
5
5
|
* `.as` resolver depends on, and what `.from([...])` may name. Checked at
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type AdaptationEntry } from "../../../Adapter/Core";
|
|
2
|
-
import type { Adaptations, Adapter, Adapting, WithAdaptations } from "../../../Adapter/Types";
|
|
3
|
-
import type { AnySchema } from "../../../Schema/Types";
|
|
4
|
-
import { type SatisfiesThis } from "../../../Schema/Satisfies";
|
|
5
|
-
import type { Pretty } from "../../../Utility/Types";
|
|
6
|
-
import type * as object from "../Types";
|
|
7
|
-
import type { Core, 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 { AnySchema } from "../../../Schema/Types.ts";
|
|
4
|
+
import { type SatisfiesThis } from "../../../Schema/Satisfies.ts";
|
|
5
|
+
import type { Pretty } from "../../../Utility/Types.ts";
|
|
6
|
+
import type * as object from "../Types.ts";
|
|
7
|
+
import type { Core, Resolved, Source } from "./Types.ts";
|
|
8
8
|
/**
|
|
9
9
|
* The fields a `.from([...])` resolver is handed: only the named ones, each
|
|
10
10
|
* keeping its own `?:` (an omittable or optional dependency may be absent).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Adaptations } from "../../../Adapter/Types";
|
|
2
|
-
import type { AnySchema, Fabricated as FabricatedBy } from "../../../Schema/Types";
|
|
3
|
-
import { Kind, type Adaptation, type Meta, type Produced, type Produces } from "../../../Types";
|
|
1
|
+
import type { Adaptations } from "../../../Adapter/Types.ts";
|
|
2
|
+
import type { AnySchema, Fabricated as FabricatedBy } from "../../../Schema/Types.ts";
|
|
3
|
+
import { Kind, type Adaptation, type Meta, type Produced, type Produces } from "../../../Types.ts";
|
|
4
4
|
/**
|
|
5
5
|
* A builder that can mint a Schema via `as` — e.g. `T.string`, `T.bigint`.
|
|
6
6
|
* `compute` accepts one alongside a plain Schema so a caller needn't satisfy a
|
|
@@ -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,8 +1,8 @@
|
|
|
1
|
-
export * from "./Types";
|
|
2
|
-
export * from "./Schema";
|
|
3
|
-
export * from "./Fabricator";
|
|
4
|
-
export * from "./Registry";
|
|
5
|
-
export { default } from "./Registry";
|
|
6
|
-
export * as compute from "./compute";
|
|
7
|
-
export * as omittable from "./omittable";
|
|
8
|
-
export * as optional from "./optional";
|
|
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";
|
|
6
|
+
export * as compute from "./compute/index.ts";
|
|
7
|
+
export * as omittable from "./omittable/index.ts";
|
|
8
|
+
export * as optional from "./optional/index.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Schema } from "../Schema";
|
|
2
|
-
import type { DefinitionOf, Subsettable } from "../Types";
|
|
1
|
+
import type { Schema } from "../Schema.ts";
|
|
2
|
+
import type { DefinitionOf, Subsettable } from "../Types.ts";
|
|
3
3
|
/**
|
|
4
4
|
* `T.omit(source, keys)`: an `object` Schema without `keys`. `T.pick`'s
|
|
5
5
|
* inverse, and not a kind either — see `subset` in `object/Registry.ts`.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Registry";
|
|
2
|
-
export { default } from "./Registry";
|
|
1
|
+
export * from "./Registry.ts";
|
|
2
|
+
export { default } from "./Registry.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 type { Schema } from "./Schema";
|
|
6
|
-
import type { Definition, Resolved, 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 type { Schema } from "./Schema.ts";
|
|
6
|
+
import type { Definition, Resolved, Meta as ThisMeta } from "./Types.ts";
|
|
7
7
|
export type Fabrication<$Fabricator extends Fabricator<any>> = $Fabricator extends Fabricator<infer $Schema> ? Resolved<$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, Resolved, 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, Resolved, Weights } from "./Types.ts";
|
|
7
7
|
export interface Schema<$Definition extends Definition = Definition, $Adaptations extends Adaptations = {}> extends Core<$Definition, $Adaptations> {
|
|
8
8
|
/**
|
|
9
9
|
* Layer an opaque production on this schema's existing `[Meta]` — carrying
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { Kind, Meta, Omitted, type Adaptation, type Produced, type 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 { Kind, Meta, Omitted, type Adaptation, type Produced, type Produces } from "../../../Types.ts";
|
|
5
5
|
/**
|
|
6
6
|
* The wrapped field's own Schema — the value type an omittable field produces
|
|
7
7
|
* when its presence roll comes up present.
|
|
@@ -14,7 +14,7 @@ export type Fabricated<$Definition extends Definition, $Bindings extends unknown
|
|
|
14
14
|
* `.as(...)`, an opaque producer.
|
|
15
15
|
*/
|
|
16
16
|
export type Resolved<$Definition extends Definition> = Fabricated<$Definition> | typeof Omitted;
|
|
17
|
-
export type { Outcome } from "./Outcomes";
|
|
17
|
+
export type { Outcome } from "./Outcomes.ts";
|
|
18
18
|
/**
|
|
19
19
|
* Relative weights for `.weighted(...)`, keyed by `Outcome`. Keys optional — an
|
|
20
20
|
* 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 type { Schema } from "./Schema";
|
|
6
|
-
import type { Definition, Resolved, 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 type { Schema } from "./Schema.ts";
|
|
6
|
+
import type { Definition, Resolved, Meta as ThisMeta } from "./Types.ts";
|
|
7
7
|
export type Fabrication<$Fabricator extends Fabricator<any>> = $Fabricator extends Fabricator<infer $Schema> ? Resolved<$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, Resolved, 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, Resolved, Weights } from "./Types.ts";
|
|
7
7
|
export interface Schema<$Definition extends Definition = Definition, $Adaptations extends Adaptations = {}> extends Core<$Definition, $Adaptations> {
|
|
8
8
|
/**
|
|
9
9
|
* Layer an opaque production on this schema's existing `[Meta]` — carrying
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { Kind, Meta, Omitted, type Adaptation, type Produced, type 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 { Kind, Meta, Omitted, type Adaptation, type Produced, type Produces } from "../../../Types.ts";
|
|
5
5
|
/**
|
|
6
6
|
* The wrapped field's Schema — the value type when the roll is
|
|
7
7
|
* present-with-a-value.
|
|
@@ -22,7 +22,7 @@ export type Fabricated<$Definition extends Definition, $Bindings extends unknown
|
|
|
22
22
|
* three-way roll or, via `.as(...)`, an opaque producer.
|
|
23
23
|
*/
|
|
24
24
|
export type Resolved<$Definition extends Definition> = Fabricated<$Definition> | typeof Omitted;
|
|
25
|
-
export type { Outcome } from "./Outcomes";
|
|
25
|
+
export type { Outcome } from "./Outcomes.ts";
|
|
26
26
|
/**
|
|
27
27
|
* Relative weights for `.weighted(...)`, keyed by `Outcome`. Keys optional — an
|
|
28
28
|
* omitted key falls back to baseline `1`, the same weight the uniform 1/3 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,5 +1,5 @@
|
|
|
1
|
-
import type { Schema } from "../Schema";
|
|
2
|
-
import type { DefinitionOf, Subsettable } from "../Types";
|
|
1
|
+
import type { Schema } from "../Schema.ts";
|
|
2
|
+
import type { DefinitionOf, Subsettable } from "../Types.ts";
|
|
3
3
|
/**
|
|
4
4
|
* `T.pick(source, keys)`: an `object` Schema with only `keys`, in source order.
|
|
5
5
|
* Not a kind — the result is an ordinary `object` Schema. See `subset` in
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Registry";
|
|
2
|
-
export { default } from "./Registry";
|
|
1
|
+
export * from "./Registry.ts";
|
|
2
|
+
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, 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<$Fabricator extends Fabricator> = $Fabricator extends Fabricator<infer $Schema> ? $Schema[typeof Meta] extends ThisMeta<infer $T> ? Fabricated<$T> : never : never;
|
|
8
8
|
export type Fabricator<$Schema extends {
|
|
9
9
|
[Meta]: ThisMeta<any>;
|