@ghostry/fabricator 0.0.9 → 0.0.11
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/Distribution/index.js +43 -11
- package/dist/esm/Primitive/null/Registry.js +2 -3
- package/dist/esm/Primitive/undefined/Registry.js +2 -3
- package/dist/esm/index.js +1 -0
- package/dist/esm/internal.js +2 -1
- package/dist/types/Adapter/Types.d.ts +3 -2
- package/dist/types/Distribution/index.d.ts +32 -2
- package/dist/types/Enumeration/Types.d.ts +3 -3
- package/dist/types/Fabricator/Types.d.ts +8 -8
- package/dist/types/Primitive/always/Types.d.ts +2 -2
- package/dist/types/Primitive/array/Types.d.ts +4 -4
- package/dist/types/Primitive/bigint/Types.d.ts +2 -2
- package/dist/types/Primitive/boolean/Types.d.ts +2 -2
- package/dist/types/Primitive/choice/Registry.d.ts +3 -3
- package/dist/types/Primitive/choice/Types.d.ts +4 -4
- package/dist/types/Primitive/date/Types.d.ts +2 -2
- package/dist/types/Primitive/derive/Types.d.ts +2 -2
- package/dist/types/Primitive/enum/Registry.d.ts +3 -3
- package/dist/types/Primitive/enum/Types.d.ts +2 -2
- package/dist/types/Primitive/null/Types.d.ts +2 -2
- package/dist/types/Primitive/nullable/Types.d.ts +4 -4
- package/dist/types/Primitive/nullish/Types.d.ts +4 -4
- package/dist/types/Primitive/number/Types.d.ts +2 -2
- package/dist/types/Primitive/object/Types.d.ts +9 -9
- package/dist/types/Primitive/object/compute/Types.d.ts +4 -4
- package/dist/types/Primitive/object/omittable/Types.d.ts +4 -4
- package/dist/types/Primitive/object/optional/Types.d.ts +4 -4
- package/dist/types/Primitive/opaque/Types.d.ts +2 -2
- package/dist/types/Primitive/record/Types.d.ts +11 -6
- package/dist/types/Primitive/recursive/Types.d.ts +12 -8
- package/dist/types/Primitive/recursive/self/Schema.d.ts +4 -4
- package/dist/types/Primitive/recursive/self/Types.d.ts +7 -5
- package/dist/types/Primitive/string/Constants.d.ts +7 -31
- package/dist/types/Primitive/string/Types.d.ts +2 -2
- package/dist/types/Primitive/symbol/Types.d.ts +2 -2
- package/dist/types/Primitive/tuple/Types.d.ts +7 -7
- package/dist/types/Primitive/undefinable/Types.d.ts +4 -4
- package/dist/types/Primitive/undefined/Types.d.ts +2 -2
- package/dist/types/Schema/Core.d.ts +10 -6
- package/dist/types/Schema/Satisfies.d.ts +31 -23
- package/dist/types/Schema/Types.d.ts +31 -18
- package/dist/types/Types.d.ts +24 -0
- package/dist/types/index.d.ts +24 -10
- package/dist/types/internal.d.ts +31 -4
- package/package.json +3 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -97,6 +97,26 @@ export { registry } from "./Schema/Registry";
|
|
|
97
97
|
*/
|
|
98
98
|
export { effectiveDiscrete, toBound } from "./Bound";
|
|
99
99
|
export type { Bound, InputBound } from "./Bound";
|
|
100
|
+
/**
|
|
101
|
+
* The `length` shapes `T.string`/`T.array`'s `.whereby(...)` accept and store,
|
|
102
|
+
* and the `distribution` every range-bearing `whereby` takes. Exported so a
|
|
103
|
+
* `whereby` argument built programmatically, or read back off a schema's `meta`
|
|
104
|
+
* in an `.adapt` producer, can be typed — the same rationale as `Bound`.
|
|
105
|
+
* `Distribution` is type-only: a distribution is written as its plain tagged
|
|
106
|
+
* object (`{ kind: "skew", exponent: 4 }`), and the type's namespace members
|
|
107
|
+
* (`Distribution.Normal`, …) name each variant.
|
|
108
|
+
*/
|
|
109
|
+
export type { Distribution, Range } from "./Distribution";
|
|
110
|
+
export type { InputLength, Length } from "./Bound";
|
|
111
|
+
/**
|
|
112
|
+
* `T.string`'s `composition` vocabulary: the class-weighting and `[weight,
|
|
113
|
+
* source]` forms, and the sources the second form draws from. `classes` holds
|
|
114
|
+
* each built-in class as its code point ranges, so the pair form can mix a
|
|
115
|
+
* class with an arbitrary range (`[[3, classes.lowercase], [1, unicode.bmp]]`);
|
|
116
|
+
* `unicode` holds codespace presets and `range(from, to)`.
|
|
117
|
+
*/
|
|
118
|
+
export type { CharacterClass, CharacterSource, CodepointRange, Composition, } from "./Primitive/string/Types";
|
|
119
|
+
export { classes, unicode } from "./Primitive/string/Constants";
|
|
100
120
|
/**
|
|
101
121
|
* Public because it is the type of `ProduceContext`'s `random` member — the
|
|
102
122
|
* seeded stream every kind's `.as(produce)` and `T.opaque`'s producer are
|
|
@@ -138,17 +158,11 @@ export type { Adapting } from "./Adapter/Types";
|
|
|
138
158
|
*/
|
|
139
159
|
export type { Salt } from "./Random/Types";
|
|
140
160
|
/**
|
|
141
|
-
* Reads the value type a
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*/
|
|
145
|
-
export type { Fabrication } from "./Fabricator/Types";
|
|
146
|
-
/**
|
|
147
|
-
* Reads the value type a Schema (not yet built) will eventually produce, via
|
|
148
|
-
* its phantom `[Produces]` marker. Mostly useful for a helper that accepts a
|
|
149
|
-
* Schema before it's built into a Fabricator.
|
|
161
|
+
* Reads the value type a Schema produces, via its phantom `[Produces]` marker —
|
|
162
|
+
* before it is built, which is what a helper accepting a Schema needs — or the
|
|
163
|
+
* value type a built Fabricator produces, off its `fabricate` signature.
|
|
150
164
|
*/
|
|
151
|
-
export type {
|
|
165
|
+
export type { Fabricated } from "./Schema/Types";
|
|
152
166
|
/**
|
|
153
167
|
* Check that a Schema or built Fabricator produces a value assignable to a
|
|
154
168
|
* supplied type — `.satisfies<T>()` on every kind's Schema is the main form;
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -35,15 +35,22 @@ export type { Fabrication, NaiveFabricator } from "./Fabricator/Types";
|
|
|
35
35
|
* a per-kind stand-in — a second copy of this mapping, susceptible to drift.
|
|
36
36
|
*/
|
|
37
37
|
export type { AsFabricator } from "./Fabricator/Types";
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* `Produced` travels with `Produces`: `[Produces]` holds a Schema's value type
|
|
40
|
+
* boxed, so anything outside this package that matches or infers through the
|
|
41
|
+
* brand has to name the box — `{ readonly [Produces]?: Produced<$T> }`. See
|
|
42
|
+
* `Types.ts` for why an unboxed `{ readonly [Produces]?: $T }` cannot be read
|
|
43
|
+
* exactly.
|
|
44
|
+
*/
|
|
45
|
+
export { Children, Kind, Meta, Produces, type Buildable, type Produced, } from "./Types";
|
|
46
|
+
export { isArray, isPlainObject } from "./Utility/Core";
|
|
40
47
|
export type * as Primitive from "./Primitive/namespace";
|
|
41
48
|
/**
|
|
42
49
|
* `Schema/Types.ts`'s own value-type resolution, needed by tests asserting
|
|
43
|
-
* `
|
|
50
|
+
* `Fabricated<...>` directly rather than through a built Fabricator's
|
|
44
51
|
* `Fabrication<...>`.
|
|
45
52
|
*/
|
|
46
|
-
export type {
|
|
53
|
+
export type { Fabricated } from "./Schema/Types";
|
|
47
54
|
/**
|
|
48
55
|
* `Constructor` is `Instance.Fabricator`'s own type — public in effect (every
|
|
49
56
|
* `initialize()` caller receives one), just never named directly by the `.`
|
|
@@ -64,6 +71,26 @@ export type { Axis, Enumerable, Pin, Resolvable } from "./Enumeration/Types";
|
|
|
64
71
|
*/
|
|
65
72
|
export { defaultAlgorithm, encode, randomSalt, toRandomSource, toStream, toStreamFromTrace, } from "./Random";
|
|
66
73
|
export type { Algorithm, ConstructionPins, ConstructionTrace, ConstructorOptions, Salt, Trace, } from "./Random/Types";
|
|
74
|
+
/**
|
|
75
|
+
* The shared index-selection draw every weighted kind (`enum`, `choice`,
|
|
76
|
+
* `boolean`, the presence wrappers) reaches through construction — exported so
|
|
77
|
+
* a test can measure its distribution against a raw stream, without a kind's
|
|
78
|
+
* registry guards or `.fabricate()` in between.
|
|
79
|
+
*/
|
|
80
|
+
export { weighted } from "./Distribution";
|
|
81
|
+
/**
|
|
82
|
+
* The normal CDF the `normal` distribution's truncation is computed with. The
|
|
83
|
+
* docs site's distribution explorer draws each variant's exact density, and a
|
|
84
|
+
* truncated normal's density divides by the mass this function measures —
|
|
85
|
+
* importing it rather than restating the approximation keeps the plotted curve
|
|
86
|
+
* normalized exactly as `sampler` truncates.
|
|
87
|
+
*
|
|
88
|
+
* `normalInv` is its inverse, the quantile `sampler` maps a truncated unit draw
|
|
89
|
+
* through. `@ghostry/fabricator-census` imports both to score a fitted `normal`
|
|
90
|
+
* against the exact curve fabrication will draw from, rather than against a
|
|
91
|
+
* second approximation that could disagree with it in the tails.
|
|
92
|
+
*/
|
|
93
|
+
export { normalCdf, normalInv } from "./Distribution";
|
|
67
94
|
/**
|
|
68
95
|
* The synchronous ambient carrier. `#stack` (`package.json`) selects it only
|
|
69
96
|
* where there is no `node:async_hooks` — in practice a browser bundle — so on
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghostry/fabricator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Fabricate typed data from composable schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"build:clean": "find ./dist -type f -name '*.tsbuildinfo' -delete",
|
|
77
77
|
"build": "bun run build:reset && bun run build:compile && bun run build:types && bun run build:verify && bun run build:clean",
|
|
78
78
|
"build:rsdoctor": "bun run build:reset && bun run build:compile:rsdoctor && bun run build:types && bun run build:verify && bun run build:clean",
|
|
79
|
-
"check": "tsc --noEmit",
|
|
80
|
-
"check:ts5": "bun --bun ../../node_modules/typescript-5/lib/tsc.js --noEmit",
|
|
79
|
+
"check": "tsc --noEmit && tsc --noEmit -p ./tsconfig.inexact.json",
|
|
80
|
+
"check:ts5": "bun --bun ../../node_modules/typescript-5/lib/tsc.js --noEmit && bun --bun ../../node_modules/typescript-5/lib/tsc.js --noEmit -p ./tsconfig.inexact.json",
|
|
81
81
|
"check:jsr": "DENO_BIN_PATH=$PWD/../../node_modules/.bin/deno bunx --no-install jsr publish --dry-run --allow-dirty",
|
|
82
82
|
"format": "bunx --no-install oxfmt .",
|
|
83
83
|
"test": "bun run check && bun run check:ts5 && bun run check:jsr && bun test"
|