@ghostry/fabricator 0.0.3 → 0.0.5
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/Enumeration/Enumerate.js +7 -6
- package/dist/esm/Error/index.js +1 -1
- package/dist/esm/Fabricator/Constructor.js +11 -10
- package/dist/esm/Harnessing/Core.js +7 -16
- package/dist/esm/Instance/Core.js +51 -17
- package/dist/esm/Instance/Stack/Async.js +10 -2
- package/dist/esm/Instance/Stack/Sync.js +2 -1
- package/dist/esm/Instance/Stack/Visible.js +13 -0
- package/dist/esm/Primitive/recursive/Fabricator.js +1 -1
- package/dist/esm/Random/index.js +2 -2
- package/dist/types/Enumeration/Enumerate.d.ts +15 -15
- package/dist/types/Enumeration/Types.d.ts +2 -2
- package/dist/types/Error/index.d.ts +8 -7
- package/dist/types/Fabricator/Constructor.d.ts +10 -7
- package/dist/types/Fabricator/Types.d.ts +15 -14
- package/dist/types/Harnessing/Core.d.ts +25 -25
- package/dist/types/Harnessing/Types.d.ts +56 -13
- package/dist/types/Instance/Core.d.ts +17 -6
- package/dist/types/Instance/Stack/Async.d.ts +7 -0
- package/dist/types/Instance/Stack/Sync.d.ts +5 -3
- package/dist/types/Instance/Stack/Visible.d.ts +22 -0
- package/dist/types/Instance/Types.d.ts +169 -19
- package/dist/types/Primitive/choice/Fabricator.d.ts +1 -1
- package/dist/types/Primitive/nullable/Fabricator.d.ts +1 -1
- package/dist/types/Primitive/nullish/Fabricator.d.ts +2 -2
- package/dist/types/Primitive/object/optional/Fabricator.d.ts +2 -2
- package/dist/types/Primitive/recursive/Fabricator.d.ts +7 -8
- package/dist/types/Primitive/recursive/Types.d.ts +1 -1
- package/dist/types/Primitive/recursive/self/Types.d.ts +1 -1
- package/dist/types/Primitive/undefinable/Fabricator.d.ts +1 -1
- package/dist/types/Random/Types.d.ts +23 -21
- package/dist/types/Random/index.d.ts +3 -3
- package/dist/types/harnessing.d.ts +18 -6
- package/dist/types/index.d.ts +11 -2
- package/dist/types/internal.d.ts +1 -1
- package/package.json +4 -1
|
@@ -63,7 +63,7 @@ export declare function toStream(algorithm: Algorithm, seed: string): Stream;
|
|
|
63
63
|
* `toStream(algorithm, encode(trace)).seed === stream.seed`. Not a
|
|
64
64
|
* {@link RandomSource} member: derivation depends on no per-source state (a
|
|
65
65
|
* fork shares only the algorithm), so it is a free function of `(algorithm,
|
|
66
|
-
* trace)`. `
|
|
66
|
+
* trace)`. `toConstructionTrace` is the only stateful member.
|
|
67
67
|
*
|
|
68
68
|
* {@link deriveClock} cannot route through this: a {@link Trace} carries
|
|
69
69
|
* `clock`, and `deriveClock` is what produces it. That circularity is why
|
|
@@ -76,7 +76,7 @@ export declare function toStreamFromTrace(algorithm: Algorithm, trace: Trace): S
|
|
|
76
76
|
* single `initialize()` instance owns for its lifetime. `options.clock` is
|
|
77
77
|
* baked in here, once, as a plain number — the `"derived"` policy is already
|
|
78
78
|
* resolved by the caller (`Instance/Core.ts`'s `resolveClock`) before a source
|
|
79
|
-
* is ever built, so every
|
|
80
|
-
* instant, and `fork` threads it forward unchanged.
|
|
79
|
+
* is ever built, so every construction trace this source resolves carries the
|
|
80
|
+
* identical instant, and `fork` threads it forward unchanged.
|
|
81
81
|
*/
|
|
82
82
|
export declare function toRandomSource(options: Options): RandomSource;
|
|
@@ -11,20 +11,32 @@
|
|
|
11
11
|
* package's contract this integration uses, satisfied structurally, so neither
|
|
12
12
|
* depends on the other.
|
|
13
13
|
*
|
|
14
|
+
* **Mirrors the integration contract of `@ghostry/harness` 0.0.4.** Structural
|
|
15
|
+
* satisfaction is what keeps the two packages independent, and it is also what
|
|
16
|
+
* leaves nothing to check the pairing at install time: neither manifest names
|
|
17
|
+
* the other, so a mismatched pair is caught by `tsc` at the point a consumer
|
|
18
|
+
* passes `integration(instance)` to `initialize`, with an error about shapes
|
|
19
|
+
* rather than about versions. This line is the only record of which version the
|
|
20
|
+
* copy tracks, so move it whenever that contract does — the types below are
|
|
21
|
+
* where the drift actually lives.
|
|
22
|
+
*
|
|
14
23
|
* @module
|
|
15
24
|
*/
|
|
16
25
|
/**
|
|
17
26
|
* Decorate an existing `Instance` as a `@ghostry/harness` integration — `{
|
|
18
|
-
* name, provides,
|
|
27
|
+
* name, provides, frame }`. Takes an instance rather than minting one: the
|
|
19
28
|
* caller owns `initialize(...)` (and in particular the suite-wide `clock`), and
|
|
20
29
|
* this only wraps each test body in that instance's per-identity `wrap`.
|
|
21
30
|
*/
|
|
22
31
|
export { integration } from "./Harnessing/Core";
|
|
23
32
|
/**
|
|
24
33
|
* `Identity` is what identifies one registered test or suite; `Integration` is
|
|
25
|
-
* the `{ name, provides,
|
|
26
|
-
* `provides` is a `Provides<$Context>`, one `Provider` per
|
|
27
|
-
*
|
|
28
|
-
*
|
|
34
|
+
* the `{ name, provides, frame }` shape `integration(instance)` returns —
|
|
35
|
+
* `provides` is a `Provides<$Context, $Established>`, one `Provider` per
|
|
36
|
+
* context key, each handed what the frame's wrapper established; `Frame` is the
|
|
37
|
+
* generator `frame` returns and `Wrapper` the optional value it yields; both
|
|
38
|
+
* hooks take a single object — `FrameArgs` for `frame`, and `ProviderArgs`, the
|
|
39
|
+
* same thing plus `established`, for a provider; `FabricatorTestContext` is the
|
|
40
|
+
* `{ fabricator }` slice of the test context this integration contributes.
|
|
29
41
|
*/
|
|
30
|
-
export type { FabricatorTestContext, Identity, Integration, Provider, Provides, } from "./Harnessing/Types";
|
|
42
|
+
export type { FabricatorTestContext, Frame, FrameArgs, Identity, Integration, Provider, ProviderArgs, Provides, Wrapper, } from "./Harnessing/Types";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -50,7 +50,10 @@ export declare function initialize<const $Registry extends PlainObject = typeof
|
|
|
50
50
|
clock?: Date | "derived";
|
|
51
51
|
/**
|
|
52
52
|
* The ambient carrier backing `wrap` for this lineage — override only to
|
|
53
|
-
* force a specific one.
|
|
53
|
+
* force a specific one. A choice of carrier and nothing more: lineage
|
|
54
|
+
* identity is the instance's own `ancestry[0]`, so handing the same carrier
|
|
55
|
+
* to two `initialize()` calls does not join them — neither one's reads ever
|
|
56
|
+
* resolve the other's frames.
|
|
54
57
|
*
|
|
55
58
|
* Left unset (the norm), the `#stack` package import picks it: every
|
|
56
59
|
* runtime with `node:async_hooks` — Node, Bun, Deno — gets the
|
|
@@ -149,5 +152,11 @@ export type { Trace } from "./Random/Types";
|
|
|
149
152
|
* parameter is a `Partial` of; `Overlay` is what `fork`/`wrap` accept;
|
|
150
153
|
* `Context` is `instance.context`'s own type, so a caller writing a helper that
|
|
151
154
|
* reads it can name the parameter.
|
|
155
|
+
*
|
|
156
|
+
* `Ancestry` comes with `Stack`, whose `visible` takes one, so anyone
|
|
157
|
+
* implementing a carrier can name the parameter. `Token` is deliberately _not_
|
|
158
|
+
* exported: a chain is opaque, its elements are comparable only by identity,
|
|
159
|
+
* and the ordinary "same lineage?" question is `a.root === b.root` rather than
|
|
160
|
+
* anything a caller needs to name.
|
|
152
161
|
*/
|
|
153
|
-
export type { Config, Context, Overlay, Stack } from "./Instance/Types";
|
|
162
|
+
export type { Ancestry, Config, Context, Overlay, Stack, } from "./Instance/Types";
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export type { Axis, Enumerable, Pin, Resolvable } from "./Enumeration/Types";
|
|
|
63
63
|
* directly, beneath the level `initialize()` itself exposes.
|
|
64
64
|
*/
|
|
65
65
|
export { defaultAlgorithm, encode, randomSalt, toRandomSource, toStream, toStreamFromTrace, } from "./Random";
|
|
66
|
-
export type { Algorithm, ConstructionTrace, ConstructorOptions,
|
|
66
|
+
export type { Algorithm, ConstructionPins, ConstructionTrace, ConstructorOptions, Salt, Trace, } from "./Random/Types";
|
|
67
67
|
/**
|
|
68
68
|
* The synchronous ambient carrier. `#stack` (`package.json`) selects it only
|
|
69
69
|
* 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.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Fabricate typed data from composable schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -64,6 +64,9 @@
|
|
|
64
64
|
"access": "public",
|
|
65
65
|
"provenance": true
|
|
66
66
|
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@ghostry/harness": "^0.0.4"
|
|
69
|
+
},
|
|
67
70
|
"scripts": {
|
|
68
71
|
"build:reset": "rm -rf ./dist",
|
|
69
72
|
"build:compile": "bunx --no-install --bun rslib build --config ./rslib.config.ts",
|