@ghostry/fabricator 0.0.14 → 0.0.16
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/Error/index.js +14 -9
- package/dist/esm/Fabricator/Constructor.js +44 -37
- package/dist/esm/Primitive/object/Fabricator.js +45 -43
- package/dist/esm/Primitive/object/Registry.js +41 -84
- package/dist/esm/Primitive/object/Stages.js +73 -0
- package/dist/esm/Primitive/object/compute/Fabricator.js +1 -7
- package/dist/esm/Primitive/object/compute/Registry.js +2 -4
- package/dist/esm/Primitive/recursive/Terminate.js +5 -13
- package/dist/esm/Unique/Capacity.js +2 -8
- package/dist/esm/Utility/ShallowMerge.js +1 -13
- package/dist/types/Adapter/Core.d.ts +2 -2
- package/dist/types/Adapter/Types.d.ts +1 -1
- package/dist/types/Bound.d.ts +1 -1
- package/dist/types/Distribution/index.d.ts +1 -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 +4 -4
- package/dist/types/Error/index.d.ts +27 -18
- package/dist/types/Fabricator/Constructor.d.ts +4 -4
- package/dist/types/Fabricator/Fabricate.d.ts +5 -5
- package/dist/types/Fabricator/Types.d.ts +6 -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 +10 -6
- 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 +6 -6
- 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 +1 -1
- package/dist/types/Primitive/array/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/array/Registry.d.ts +4 -4
- package/dist/types/Primitive/array/Schema.d.ts +5 -5
- package/dist/types/Primitive/array/Types.d.ts +6 -6
- package/dist/types/Primitive/array/index.d.ts +5 -5
- package/dist/types/Primitive/bigint/Admits.d.ts +1 -1
- package/dist/types/Primitive/bigint/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/bigint/Registry.d.ts +4 -4
- package/dist/types/Primitive/bigint/Schema.d.ts +5 -5
- package/dist/types/Primitive/bigint/Types.d.ts +4 -4
- 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 +1 -1
- package/dist/types/Primitive/date/Defaults.d.ts +2 -2
- package/dist/types/Primitive/date/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/date/Registry.d.ts +3 -3
- package/dist/types/Primitive/date/Schema.d.ts +5 -5
- package/dist/types/Primitive/date/Types.d.ts +6 -6
- 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 +6 -6
- package/dist/types/Primitive/enum/Registry.d.ts +2 -2
- package/dist/types/Primitive/enum/Schema.d.ts +5 -5
- package/dist/types/Primitive/enum/Types.d.ts +3 -3
- package/dist/types/Primitive/enum/index.d.ts +5 -5
- package/dist/types/Primitive/index.d.ts +28 -28
- 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 +1 -1
- package/dist/types/Primitive/number/Defaults.d.ts +1 -1
- package/dist/types/Primitive/number/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/number/Registry.d.ts +5 -5
- package/dist/types/Primitive/number/Schema.d.ts +5 -5
- package/dist/types/Primitive/number/Types.d.ts +6 -6
- package/dist/types/Primitive/number/index.d.ts +5 -5
- package/dist/types/Primitive/object/Fabricator.d.ts +20 -24
- package/dist/types/Primitive/object/Registry.d.ts +9 -11
- package/dist/types/Primitive/object/Schema.d.ts +22 -14
- package/dist/types/Primitive/object/Stages.d.ts +68 -0
- package/dist/types/Primitive/object/Types.d.ts +112 -18
- package/dist/types/Primitive/object/compute/Fabricator.d.ts +13 -14
- 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 +9 -10
- 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 +2 -2
- package/dist/types/Primitive/record/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/record/Registry.d.ts +3 -3
- package/dist/types/Primitive/record/Schema.d.ts +5 -5
- package/dist/types/Primitive/record/Types.d.ts +6 -6
- 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 +1 -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 +1 -1
- package/dist/types/Primitive/string/Capacity.d.ts +1 -1
- package/dist/types/Primitive/string/Constants.d.ts +1 -1
- package/dist/types/Primitive/string/Fabricator.d.ts +6 -6
- package/dist/types/Primitive/string/Registry.d.ts +4 -4
- package/dist/types/Primitive/string/Schema.d.ts +5 -5
- package/dist/types/Primitive/string/Sources.d.ts +1 -1
- package/dist/types/Primitive/string/Types.d.ts +6 -6
- 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 +7 -7
- package/dist/types/Primitive/unique/index.d.ts +2 -2
- 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 +2 -2
- package/dist/types/Unique/Capacity.d.ts +1 -1
- package/dist/types/Unique/Distinct.d.ts +6 -6
- package/dist/types/Unique/Strategy.d.ts +5 -5
- 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 +7 -3
- package/dist/types/adapting.d.ts +3 -3
- package/dist/types/harnessing.d.ts +2 -2
- package/dist/types/index.d.ts +30 -30
- package/dist/types/internal.d.ts +16 -16
- package/package.json +2 -3
package/dist/esm/Error/index.js
CHANGED
|
@@ -93,7 +93,7 @@ class Error_FabricatorError extends Error {
|
|
|
93
93
|
constructor(){
|
|
94
94
|
super();
|
|
95
95
|
this.name = "@ghostry/fabricator:DetachedComputeError";
|
|
96
|
-
this.message = "A `.refine()`-computed field can only be fabricated as
|
|
96
|
+
this.message = "A `.refine()`-computed field can only be built and fabricated as a field of the object that owns it, which supplies the fields its resolver reads.";
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
FabricatorError.DetachedComputeError = DetachedComputeError;
|
|
@@ -121,14 +121,19 @@ class Error_FabricatorError extends Error {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
FabricatorError.UnknownFieldError = UnknownFieldError;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
const PLACES = {
|
|
125
|
+
object: "T.object",
|
|
126
|
+
extend: ".extend",
|
|
127
|
+
rebase: ".rebase"
|
|
128
|
+
};
|
|
129
|
+
class ComputeOutsideRefineError extends FabricatorError {
|
|
130
|
+
constructor(field, operation){
|
|
131
|
+
super(), _define_property(this, "field", void 0), _define_property(this, "operation", void 0), this.field = field, this.operation = operation;
|
|
132
|
+
this.name = "@ghostry/fabricator:ComputeOutsideRefineError";
|
|
133
|
+
this.message = `Cannot place a computed field in \`${PLACES[operation]}(...)\`: "${field}". Add computed fields with \`.refine(({ compute }) => ...)\`.`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
FabricatorError.ComputeOutsideRefineError = ComputeOutsideRefineError;
|
|
132
137
|
class InvalidOverrideValueError extends FabricatorError {
|
|
133
138
|
constructor(field, kind, value){
|
|
134
139
|
super(), _define_property(this, "field", void 0), _define_property(this, "kind", void 0), _define_property(this, "value", void 0), this.field = field, this.kind = kind, this.value = value;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FabricatorError } from "../Error/index.js";
|
|
2
2
|
import { toEffectiveSource } from "../Instance/Stack/Visible.js";
|
|
3
3
|
import { Primitive } from "../Primitive/index.js";
|
|
4
|
+
import { stageOf } from "../Primitive/object/Stages.js";
|
|
4
5
|
import { isLayered, normalizeSalt, toRandomSource } from "../Random/index.js";
|
|
5
6
|
import { toSchema } from "../Schema/Core.js";
|
|
6
7
|
import { Adaptation, Fixed, Kind, Layer, Meta } from "../Types.js";
|
|
@@ -224,13 +225,7 @@ function Constructor(source, stack, ancestry, exhaustion = "throw") {
|
|
|
224
225
|
}, from);
|
|
225
226
|
}
|
|
226
227
|
case "object.compute":
|
|
227
|
-
|
|
228
|
-
const s = schema;
|
|
229
|
-
return Primitive.object.compute.Fabricator({
|
|
230
|
-
...common,
|
|
231
|
-
schema: s
|
|
232
|
-
});
|
|
233
|
-
}
|
|
228
|
+
throw new FabricatorError.DetachedComputeError();
|
|
234
229
|
case "object.omittable":
|
|
235
230
|
{
|
|
236
231
|
const s = schema;
|
|
@@ -258,44 +253,56 @@ function Constructor(source, stack, ancestry, exhaustion = "throw") {
|
|
|
258
253
|
case "object":
|
|
259
254
|
{
|
|
260
255
|
const s = schema;
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
for(const key
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const built = make(fieldSchema, fieldPath, context);
|
|
272
|
-
const value = fieldSchema[Fixed];
|
|
273
|
-
if (Primitive.object.compute.isObjectComputeFabricator(built)) return {
|
|
274
|
-
...built,
|
|
275
|
-
[Kind]: built[Meta].source[Kind],
|
|
276
|
-
fabricate: ()=>value
|
|
277
|
-
};
|
|
278
|
-
return {
|
|
279
|
-
...built,
|
|
280
|
-
fabricate: ()=>value
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
return make(fieldSchema, fieldPath, context);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
return fields;
|
|
287
|
-
};
|
|
288
|
-
const fields = build(s[Meta].definition);
|
|
289
|
-
const hidden = s[Meta].hidden ? build(s[Meta].hidden) : {};
|
|
256
|
+
const stages = s[Meta].stages.map((stage)=>{
|
|
257
|
+
const built = {};
|
|
258
|
+
for (const key of Object.keys(stage))built[key] = buildField(stage[key], [
|
|
259
|
+
...path,
|
|
260
|
+
key
|
|
261
|
+
], context);
|
|
262
|
+
return built;
|
|
263
|
+
});
|
|
264
|
+
const fields = {};
|
|
265
|
+
for (const key of Object.keys(s[Meta].definition))fields[key] = stages[stageOf(s[Meta].stages, key)][key];
|
|
290
266
|
return Primitive.object.Fabricator({
|
|
291
267
|
...common,
|
|
292
268
|
schema: Primitive.object.rehydrate(s)
|
|
293
|
-
}, fields,
|
|
269
|
+
}, fields, stages);
|
|
294
270
|
}
|
|
295
271
|
default:
|
|
296
272
|
throw new FabricatorError.UnknownKindError(String(kind), "construction");
|
|
297
273
|
}
|
|
298
274
|
}
|
|
275
|
+
function buildField(fieldSchema, fieldPath, context) {
|
|
276
|
+
fieldSchema = Fixed in fieldSchema ? {
|
|
277
|
+
...toSchema(fieldSchema),
|
|
278
|
+
[Fixed]: fieldSchema[Fixed]
|
|
279
|
+
} : toSchema(fieldSchema);
|
|
280
|
+
if ("object.compute" === fieldSchema[Kind]) {
|
|
281
|
+
const s = fieldSchema;
|
|
282
|
+
const built = Primitive.object.compute.Fabricator({
|
|
283
|
+
algorithm: context.algorithm,
|
|
284
|
+
trace: context.toTrace(fieldPath, "object.compute"),
|
|
285
|
+
exhaustion: context.exhaustion,
|
|
286
|
+
schema: s
|
|
287
|
+
});
|
|
288
|
+
if (!(Fixed in fieldSchema)) return built;
|
|
289
|
+
const value = fieldSchema[Fixed];
|
|
290
|
+
return {
|
|
291
|
+
...built,
|
|
292
|
+
[Kind]: s[Meta].source[Kind],
|
|
293
|
+
fabricate: ()=>value
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
if (Fixed in fieldSchema) {
|
|
297
|
+
const built = make(fieldSchema, fieldPath, context);
|
|
298
|
+
const value = fieldSchema[Fixed];
|
|
299
|
+
return {
|
|
300
|
+
...built,
|
|
301
|
+
fabricate: ()=>value
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
return make(fieldSchema, fieldPath, context);
|
|
305
|
+
}
|
|
299
306
|
function construct(schema, options = {}) {
|
|
300
307
|
var _options_path;
|
|
301
308
|
if ("string" == typeof options.kind && options.kind !== schema[Kind]) throw new FabricatorError.TraceKindMismatchError(schema[Kind], options.kind);
|
|
@@ -6,10 +6,11 @@ import { isPollutionKey } from "../../Utility/Core.js";
|
|
|
6
6
|
import { isObjectComputeFabricator } from "./compute/Fabricator.js";
|
|
7
7
|
import { isObjectOmittableFabricator } from "./omittable/Fabricator.js";
|
|
8
8
|
import { isObjectOptionalFabricator } from "./optional/Fabricator.js";
|
|
9
|
+
import { stageOf } from "./Stages.js";
|
|
9
10
|
function isObjectFabricator(candidate) {
|
|
10
11
|
return "object" === candidate[Kind];
|
|
11
12
|
}
|
|
12
|
-
function Fabricator(context, fields,
|
|
13
|
+
function Fabricator(context, fields, stages) {
|
|
13
14
|
const { schema, algorithm, trace } = context;
|
|
14
15
|
const meta = schema[Meta];
|
|
15
16
|
if (meta.produce) {
|
|
@@ -38,41 +39,56 @@ function Fabricator(context, fields, hidden = {}) {
|
|
|
38
39
|
schema
|
|
39
40
|
};
|
|
40
41
|
}
|
|
42
|
+
const entries = stages.flatMap((stage, at)=>Object.keys(stage).map((key)=>{
|
|
43
|
+
const field = stage[key];
|
|
44
|
+
return {
|
|
45
|
+
at,
|
|
46
|
+
key,
|
|
47
|
+
field,
|
|
48
|
+
visible: fields[key] === field,
|
|
49
|
+
reads: isObjectComputeFabricator(field) ? field[Meta].dependencies.map((dependency)=>[
|
|
50
|
+
dependency,
|
|
51
|
+
stageOf(stages, dependency, at)
|
|
52
|
+
]) : []
|
|
53
|
+
};
|
|
54
|
+
}));
|
|
41
55
|
const fabricate = (overrides, config)=>{
|
|
42
56
|
if (overrides && (null == config ? void 0 : config.validate) !== false) schema.override(overrides);
|
|
43
|
-
const
|
|
44
|
-
const deferred =
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
...Object.entries(fields).map(([k, v])=>[
|
|
52
|
-
k,
|
|
53
|
-
v,
|
|
54
|
-
true
|
|
55
|
-
])
|
|
56
|
-
];
|
|
57
|
-
for (const [k, v, visible] of entries){
|
|
58
|
-
if (isPollutionKey(k)) throw new FabricatorError.PrototypePollutionError(k);
|
|
59
|
-
if (visible && overrides && k in overrides) {
|
|
60
|
-
const value = overrides[k];
|
|
61
|
-
recordOverride(v, value);
|
|
57
|
+
const values = stages.map(()=>new Map());
|
|
58
|
+
const deferred = [];
|
|
59
|
+
for (const entry of entries){
|
|
60
|
+
const { at, key, field, visible } = entry;
|
|
61
|
+
if (isPollutionKey(key)) throw new FabricatorError.PrototypePollutionError(key);
|
|
62
|
+
if (visible && overrides && key in overrides) {
|
|
63
|
+
const value = overrides[key];
|
|
64
|
+
recordOverride(field, value);
|
|
62
65
|
if (value === Omitted) continue;
|
|
63
|
-
|
|
66
|
+
values[at].set(key, isObjectFabricator(field) ? field.fabricate(value, {
|
|
64
67
|
validate: false
|
|
65
|
-
}) : value;
|
|
68
|
+
}) : value);
|
|
66
69
|
continue;
|
|
67
70
|
}
|
|
68
|
-
if (isObjectOmittableFabricator(
|
|
69
|
-
const value =
|
|
70
|
-
if (value !== Omitted)
|
|
71
|
-
} else if (isObjectComputeFabricator(
|
|
72
|
-
else
|
|
71
|
+
if (isObjectOmittableFabricator(field) || isObjectOptionalFabricator(field)) {
|
|
72
|
+
const value = field.fabricate();
|
|
73
|
+
if (value !== Omitted) values[at].set(key, value);
|
|
74
|
+
} else if (isObjectComputeFabricator(field)) deferred.push(entry);
|
|
75
|
+
else values[at].set(key, field.fabricate());
|
|
76
|
+
}
|
|
77
|
+
for (const { at, key, field, reads } of deferred){
|
|
78
|
+
const input = {};
|
|
79
|
+
for (const [dependency, from] of reads){
|
|
80
|
+
const read = values[from];
|
|
81
|
+
if (null == read ? void 0 : read.has(dependency)) input[dependency] = read.get(dependency);
|
|
82
|
+
}
|
|
83
|
+
values[at].set(key, field.fabricate({
|
|
84
|
+
fabricated: input
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
const fabricated = {};
|
|
88
|
+
for (const key of Object.keys(fields)){
|
|
89
|
+
const read = values[stageOf(stages, key)];
|
|
90
|
+
if (read.has(key)) fabricated[key] = read.get(key);
|
|
73
91
|
}
|
|
74
|
-
resolveComputed(deferred, fabricated);
|
|
75
|
-
for (const k of Object.keys(hidden))delete fabricated[k];
|
|
76
92
|
return fabricated;
|
|
77
93
|
};
|
|
78
94
|
return {
|
|
@@ -84,18 +100,4 @@ function Fabricator(context, fields, hidden = {}) {
|
|
|
84
100
|
schema
|
|
85
101
|
};
|
|
86
102
|
}
|
|
87
|
-
function resolveComputed(deferred, fabricated) {
|
|
88
|
-
const resolved = new Set();
|
|
89
|
-
const resolve = (key)=>{
|
|
90
|
-
if (resolved.has(key)) return;
|
|
91
|
-
const field = deferred.get(key);
|
|
92
|
-
if (!field) return;
|
|
93
|
-
for (const dependency of field[Meta].dependencies)resolve(dependency);
|
|
94
|
-
fabricated[key] = field.fabricate({
|
|
95
|
-
fabricated
|
|
96
|
-
});
|
|
97
|
-
resolved.add(key);
|
|
98
|
-
};
|
|
99
|
-
for (const key of deferred.keys())resolve(key);
|
|
100
|
-
}
|
|
101
103
|
export { Fabricator, isObjectFabricator };
|
|
@@ -3,7 +3,6 @@ import { FabricatorError } from "../../Error/index.js";
|
|
|
3
3
|
import { toSchema, toValueKind, violatesKind } from "../../Schema/Core.js";
|
|
4
4
|
import { Adaptation, Fixed, Kind, Meta, Omitted } from "../../Types.js";
|
|
5
5
|
import { isPlainObject } from "../../Utility/Core.js";
|
|
6
|
-
import { shallowMerge } from "../../Utility/ShallowMerge.js";
|
|
7
6
|
import { isNullableSchema } from "../nullable/Schema.js";
|
|
8
7
|
import { isNullishSchema } from "../nullish/Schema.js";
|
|
9
8
|
import { isUndefinableSchema } from "../undefinable/Schema.js";
|
|
@@ -12,58 +11,62 @@ import { isObjectComputeSchema } from "./compute/Schema.js";
|
|
|
12
11
|
import { isObjectOmittableSchema } from "./omittable/Schema.js";
|
|
13
12
|
import { isObjectOptionalSchema } from "./optional/Schema.js";
|
|
14
13
|
import { Schema, isObjectSchema } from "./Schema.js";
|
|
14
|
+
import { firstStageOf, prune, stageKeys, toDefinition, withEntries, withOriginals } from "./Stages.js";
|
|
15
15
|
function normalizeDefinition(definition) {
|
|
16
16
|
return Object.fromEntries(Object.entries(definition).map(([k, v])=>[
|
|
17
17
|
k,
|
|
18
18
|
toSchema(v)
|
|
19
19
|
]));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
return
|
|
21
|
+
function normalizeFields(definition, operation) {
|
|
22
|
+
const normalized = normalizeDefinition(definition);
|
|
23
|
+
for (const [key, entry] of Object.entries(normalized))if (isObjectComputeSchema(entry)) throw new FabricatorError.ComputeOutsideRefineError(key, operation);
|
|
24
|
+
return normalized;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...
|
|
30
|
-
|
|
26
|
+
function appendKeys(order, keys) {
|
|
27
|
+
const known = new Set(order);
|
|
28
|
+
return [
|
|
29
|
+
...order,
|
|
30
|
+
...keys.filter((key)=>!known.has(key))
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
function make(allStages, order, adaptations) {
|
|
34
|
+
const stages = prune(allStages, order);
|
|
35
|
+
const definition = toDefinition(stages, order);
|
|
31
36
|
const schema = Schema({
|
|
32
37
|
[Kind]: "object",
|
|
33
|
-
[Meta]:
|
|
34
|
-
definition,
|
|
35
|
-
refinements,
|
|
36
|
-
hidden
|
|
37
|
-
} : {
|
|
38
|
+
[Meta]: {
|
|
38
39
|
definition,
|
|
39
|
-
|
|
40
|
+
stages
|
|
40
41
|
},
|
|
41
42
|
...adaptations ? {
|
|
42
43
|
[Adaptation]: adaptations
|
|
43
44
|
} : void 0,
|
|
44
45
|
extend: (extender)=>{
|
|
45
|
-
const extension =
|
|
46
|
+
const extension = normalizeFields(extender({
|
|
46
47
|
base: definition
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
return make(merged, refinements, adaptations, unhide(hidden, extension));
|
|
48
|
+
}), "extend");
|
|
49
|
+
return make(withEntries(stages, extension), appendKeys(order, Object.keys(extension)), adaptations);
|
|
50
50
|
},
|
|
51
51
|
refine: (refiner)=>{
|
|
52
|
-
const compute = compute_0(
|
|
52
|
+
const compute = compute_0(order);
|
|
53
53
|
const refinement = normalizeDefinition(refiner({
|
|
54
54
|
base: schema,
|
|
55
55
|
compute
|
|
56
56
|
}));
|
|
57
|
-
return make(
|
|
58
|
-
...
|
|
57
|
+
return make([
|
|
58
|
+
...stages,
|
|
59
59
|
refinement
|
|
60
|
-
],
|
|
60
|
+
], appendKeys(order, Object.keys(refinement)), adaptations);
|
|
61
|
+
},
|
|
62
|
+
rebase: (fields)=>{
|
|
63
|
+
const originals = normalizeFields(fields, "rebase");
|
|
64
|
+
for (const key of Object.keys(originals))if (-1 === firstStageOf(stages, key)) throw new FabricatorError.UnknownFieldError(key, stageKeys(stages, order), "rebase");
|
|
65
|
+
return make(withOriginals(stages, originals), order, adaptations);
|
|
61
66
|
},
|
|
62
|
-
adapt: (adapter, produce)=>make(
|
|
67
|
+
adapt: (adapter, produce)=>make(stages, order, mergeAdaptations(adaptations, adapter, produce)),
|
|
63
68
|
override: (override)=>{
|
|
64
|
-
const overridden = {
|
|
65
|
-
...definition
|
|
66
|
-
};
|
|
69
|
+
const overridden = {};
|
|
67
70
|
for (const key of Object.keys(override)){
|
|
68
71
|
const fieldSchema = definition[key];
|
|
69
72
|
if (!fieldSchema) throw new FabricatorError.UnknownFieldError(key, Object.keys(definition), "override");
|
|
@@ -146,61 +149,17 @@ function make(definition, refinements, adaptations, hidden) {
|
|
|
146
149
|
[Fixed]: value
|
|
147
150
|
};
|
|
148
151
|
}
|
|
149
|
-
return make(overridden,
|
|
152
|
+
return make(withEntries(stages, overridden), order, adaptations);
|
|
150
153
|
}
|
|
151
154
|
});
|
|
152
155
|
return schema;
|
|
153
156
|
}
|
|
154
157
|
function rehydrate(schema) {
|
|
155
|
-
const rehydrated = make(schema[Meta].
|
|
158
|
+
const rehydrated = make(schema[Meta].stages, Object.keys(schema[Meta].definition), schema[Adaptation]);
|
|
156
159
|
return schema[Meta].produce ? rehydrated.as(schema[Meta].produce) : rehydrated;
|
|
157
160
|
}
|
|
158
|
-
function dependenciesOf(entry) {
|
|
159
|
-
if (Fixed in entry) return [];
|
|
160
|
-
if (!isObjectComputeSchema(entry)) return [];
|
|
161
|
-
return entry[Meta].dependencies;
|
|
162
|
-
}
|
|
163
|
-
function assertAcyclic(all) {
|
|
164
|
-
const visiting = [];
|
|
165
|
-
const visited = new Set();
|
|
166
|
-
const visit = (key)=>{
|
|
167
|
-
if (visited.has(key)) return;
|
|
168
|
-
const entry = all[key];
|
|
169
|
-
if (!entry) return;
|
|
170
|
-
if (visiting.includes(key)) {
|
|
171
|
-
const loop = visiting.slice(visiting.indexOf(key));
|
|
172
|
-
throw new FabricatorError.ComputeDependencyCycleError([
|
|
173
|
-
...loop,
|
|
174
|
-
key
|
|
175
|
-
]);
|
|
176
|
-
}
|
|
177
|
-
visiting.push(key);
|
|
178
|
-
for (const dependency of dependenciesOf(entry))visit(dependency);
|
|
179
|
-
visiting.pop();
|
|
180
|
-
visited.add(key);
|
|
181
|
-
};
|
|
182
|
-
for (const key of Object.keys(all))visit(key);
|
|
183
|
-
}
|
|
184
|
-
function requiredKeys(kept, all) {
|
|
185
|
-
const needed = new Set(kept);
|
|
186
|
-
const pending = [
|
|
187
|
-
...kept
|
|
188
|
-
];
|
|
189
|
-
while(pending.length > 0){
|
|
190
|
-
const entry = all[pending.pop()];
|
|
191
|
-
if (!entry) continue;
|
|
192
|
-
for (const dependency of dependenciesOf(entry))if (!needed.has(dependency)) {
|
|
193
|
-
needed.add(dependency);
|
|
194
|
-
pending.push(dependency);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return needed;
|
|
198
|
-
}
|
|
199
|
-
function selectEntries(definition, keys) {
|
|
200
|
-
return Object.fromEntries(Object.entries(definition).filter(([key])=>keys.has(key)));
|
|
201
|
-
}
|
|
202
161
|
function subset(source, keys, operation) {
|
|
203
|
-
const { definition,
|
|
162
|
+
const { definition, stages } = source[Meta];
|
|
204
163
|
const available = Object.keys(definition);
|
|
205
164
|
for (const key of keys)if (!available.includes(key)) throw new FabricatorError.UnknownFieldError(key, available, operation);
|
|
206
165
|
const named = new Set(keys);
|
|
@@ -212,15 +171,13 @@ function subset(source, keys, operation) {
|
|
|
212
171
|
return !named.has(key);
|
|
213
172
|
}
|
|
214
173
|
});
|
|
215
|
-
|
|
216
|
-
const all = {
|
|
217
|
-
...hidden,
|
|
218
|
-
...definition
|
|
219
|
-
};
|
|
220
|
-
const required = requiredKeys(kept, all);
|
|
221
|
-
const hiddenKeys = new Set(Object.keys(all).filter((key)=>required.has(key) && !keptSet.has(key)));
|
|
222
|
-
return make(selectEntries(definition, keptSet), refinements.map((refinement)=>selectEntries(refinement, keptSet)).filter((refinement)=>Object.keys(refinement).length > 0), void 0, hiddenKeys.size > 0 ? selectEntries(all, hiddenKeys) : void 0);
|
|
174
|
+
return make(stages, kept);
|
|
223
175
|
}
|
|
224
|
-
const Registry = (definition)=>
|
|
176
|
+
const Registry = (definition)=>{
|
|
177
|
+
const fields = normalizeFields(definition, "object");
|
|
178
|
+
return make([
|
|
179
|
+
fields
|
|
180
|
+
], Object.keys(fields));
|
|
181
|
+
};
|
|
225
182
|
export default Registry;
|
|
226
183
|
export { rehydrate, subset };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Fixed, Kind, Meta } from "../../Types.js";
|
|
2
|
+
function stageOf(stages, key, before = stages.length) {
|
|
3
|
+
for(let i = Math.min(before, stages.length) - 1; i >= 0; i--)if (has(stages[i], key)) return i;
|
|
4
|
+
return -1;
|
|
5
|
+
}
|
|
6
|
+
function firstStageOf(stages, key) {
|
|
7
|
+
return stages.findIndex((stage)=>has(stage, key));
|
|
8
|
+
}
|
|
9
|
+
function stageKeys(stages, order) {
|
|
10
|
+
const keys = new Set(order);
|
|
11
|
+
for (const stage of stages)for (const key of Object.keys(stage))keys.add(key);
|
|
12
|
+
return [
|
|
13
|
+
...keys
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
function readsOf(entry) {
|
|
17
|
+
if (Fixed in entry) return [];
|
|
18
|
+
if ("object.compute" !== entry[Kind]) return [];
|
|
19
|
+
return entry[Meta].dependencies;
|
|
20
|
+
}
|
|
21
|
+
function toDefinition(stages, order) {
|
|
22
|
+
const definition = {};
|
|
23
|
+
for (const key of order)put(definition, key, stages[stageOf(stages, key)][key]);
|
|
24
|
+
return definition;
|
|
25
|
+
}
|
|
26
|
+
function withEntries(stages, entries) {
|
|
27
|
+
const next = stages.map((stage)=>({
|
|
28
|
+
...stage
|
|
29
|
+
}));
|
|
30
|
+
if (0 === next.length) next.push({});
|
|
31
|
+
for (const [key, entry] of Object.entries(entries)){
|
|
32
|
+
const at = stageOf(next, key);
|
|
33
|
+
put(next[-1 === at ? next.length - 1 : at], key, entry);
|
|
34
|
+
}
|
|
35
|
+
return next;
|
|
36
|
+
}
|
|
37
|
+
function withOriginals(stages, entries) {
|
|
38
|
+
const next = stages.map((stage)=>({
|
|
39
|
+
...stage
|
|
40
|
+
}));
|
|
41
|
+
for (const [key, entry] of Object.entries(entries))put(next[firstStageOf(next, key)], key, entry);
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
44
|
+
function prune(stages, order) {
|
|
45
|
+
const kept = stages.map(()=>new Set());
|
|
46
|
+
const pending = [];
|
|
47
|
+
const keep = (at, key)=>{
|
|
48
|
+
if (-1 === at || kept[at].has(key)) return;
|
|
49
|
+
kept[at].add(key);
|
|
50
|
+
pending.push([
|
|
51
|
+
at,
|
|
52
|
+
key
|
|
53
|
+
]);
|
|
54
|
+
};
|
|
55
|
+
for (const key of order)keep(stageOf(stages, key), key);
|
|
56
|
+
while(pending.length > 0){
|
|
57
|
+
const [at, key] = pending.pop();
|
|
58
|
+
for (const dependency of readsOf(stages[at][key]))keep(stageOf(stages, dependency, at), dependency);
|
|
59
|
+
}
|
|
60
|
+
return stages.map((stage, i)=>Object.fromEntries(Object.entries(stage).filter(([key])=>kept[i].has(key)))).filter((stage)=>Object.keys(stage).length > 0);
|
|
61
|
+
}
|
|
62
|
+
function has(target, key) {
|
|
63
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
64
|
+
}
|
|
65
|
+
function put(target, key, value) {
|
|
66
|
+
Object.defineProperty(target, key, {
|
|
67
|
+
value,
|
|
68
|
+
enumerable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
configurable: true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export { firstStageOf, prune, readsOf, stageKeys, stageOf, toDefinition, withEntries, withOriginals };
|
|
@@ -13,9 +13,8 @@ function Fabricator(context) {
|
|
|
13
13
|
fabricate: (params)=>{
|
|
14
14
|
if (!params) throw new FabricatorError.DetachedComputeError();
|
|
15
15
|
const meta = schema[Meta];
|
|
16
|
-
const fabricated = meta.narrowed ? narrow(params.fabricated, meta.dependencies) : params.fabricated;
|
|
17
16
|
const resolved = meta.resolve({
|
|
18
|
-
fabricated
|
|
17
|
+
fabricated: params.fabricated
|
|
19
18
|
});
|
|
20
19
|
const sourceKind = meta.source[Kind];
|
|
21
20
|
if (violatesKind(sourceKind, resolved)) throw new FabricatorError.ComputeResultMismatchError(sourceKind, resolved);
|
|
@@ -23,9 +22,4 @@ function Fabricator(context) {
|
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
|
-
function narrow(fabricated, dependencies) {
|
|
27
|
-
const narrowed = {};
|
|
28
|
-
for (const key of dependencies)if (key in fabricated) narrowed[key] = fabricated[key];
|
|
29
|
-
return narrowed;
|
|
30
|
-
}
|
|
31
25
|
export { Fabricator, isObjectComputeFabricator };
|
|
@@ -8,8 +8,7 @@ function make(base) {
|
|
|
8
8
|
[Meta]: {
|
|
9
9
|
source,
|
|
10
10
|
resolve,
|
|
11
|
-
dependencies: base
|
|
12
|
-
narrowed: false
|
|
11
|
+
dependencies: base
|
|
13
12
|
}
|
|
14
13
|
}),
|
|
15
14
|
from: (keys)=>{
|
|
@@ -20,8 +19,7 @@ function make(base) {
|
|
|
20
19
|
[Meta]: {
|
|
21
20
|
source,
|
|
22
21
|
resolve,
|
|
23
|
-
dependencies: keys
|
|
24
|
-
narrowed: true
|
|
22
|
+
dependencies: keys
|
|
25
23
|
}
|
|
26
24
|
})
|
|
27
25
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FabricatorError } from "../../Error/index.js";
|
|
2
2
|
import { Adaptation, Kind, Meta, Omitted } from "../../Types.js";
|
|
3
3
|
import { never } from "../../Utility/Core.js";
|
|
4
|
+
import { toDefinition } from "../object/Stages.js";
|
|
4
5
|
import { toStatedSize } from "../record/Admits.js";
|
|
5
6
|
function terminate(body) {
|
|
6
7
|
return terminateAt(body, []);
|
|
@@ -74,16 +75,11 @@ function terminateAt(schema, path) {
|
|
|
74
75
|
]);
|
|
75
76
|
return next;
|
|
76
77
|
};
|
|
77
|
-
const
|
|
78
|
-
if (!s[Meta].hidden) return withMeta(s, {
|
|
79
|
-
...s[Meta],
|
|
80
|
-
definition
|
|
81
|
-
});
|
|
82
|
-
const hidden = terminateFields(s[Meta].hidden);
|
|
78
|
+
const stages = s[Meta].stages.map(terminateFields);
|
|
83
79
|
return withMeta(s, {
|
|
84
80
|
...s[Meta],
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
stages,
|
|
82
|
+
definition: toDefinition(stages, Object.keys(s[Meta].definition))
|
|
87
83
|
});
|
|
88
84
|
}
|
|
89
85
|
case "tuple":
|
|
@@ -185,11 +181,7 @@ function containsSelf(schema) {
|
|
|
185
181
|
case "object":
|
|
186
182
|
{
|
|
187
183
|
const s = schema;
|
|
188
|
-
|
|
189
|
-
...s[Meta].hidden,
|
|
190
|
-
...s[Meta].definition
|
|
191
|
-
};
|
|
192
|
-
return Object.keys(all).some((key)=>containsSelf(all[key]));
|
|
184
|
+
return s[Meta].stages.some((stage)=>Object.keys(stage).some((key)=>containsSelf(stage[key])));
|
|
193
185
|
}
|
|
194
186
|
case "tuple":
|
|
195
187
|
{
|
|
@@ -22,14 +22,8 @@ function walk(node, draws, clock, limits) {
|
|
|
22
22
|
const visit = (child, times = draws)=>walk(child, times, clock, limits);
|
|
23
23
|
switch(node[Kind]){
|
|
24
24
|
case "object":
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...meta.definition,
|
|
28
|
-
...meta.hidden
|
|
29
|
-
};
|
|
30
|
-
for (const field of Object.values(fields))if (!(Fixed in field)) visit(field);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
25
|
+
for (const stage of meta.stages)for (const field of Object.values(stage))if (!(Fixed in field)) visit(field);
|
|
26
|
+
return;
|
|
33
27
|
case "tuple":
|
|
34
28
|
meta.items.forEach((item)=>visit(item));
|
|
35
29
|
return;
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { mergeableKeys } from "./Core.js";
|
|
3
|
-
function shallowMerge(a, b) {
|
|
4
|
-
const result = {};
|
|
5
|
-
if (Replace in b && true === b[Replace]) {
|
|
6
|
-
for (const key of mergeableKeys(b))result[key] = b[key];
|
|
7
|
-
return result;
|
|
8
|
-
}
|
|
9
|
-
for (const key of mergeableKeys(a))result[key] = a[key];
|
|
10
|
-
for (const key of mergeableKeys(b))result[key] = b[key];
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
export { shallowMerge };
|
|
1
|
+
export { };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Adaptation } from "../Types";
|
|
2
|
-
import type { Adaptations, AdaptationsOf, Adapter, Adapting, WithAdaptations } from "./Types";
|
|
1
|
+
import { Adaptation } from "../Types.ts";
|
|
2
|
+
import type { Adaptations, AdaptationsOf, Adapter, Adapting, WithAdaptations } from "./Types.ts";
|
|
3
3
|
type OverrideSchemaAdaptation<$Schema extends object, $Map extends Adaptations> = Omit<$Schema, typeof Adaptation> & {
|
|
4
4
|
readonly [Adaptation]?: WithAdaptations<AdaptationsOf<$Schema>, $Map>;
|
|
5
5
|
};
|
package/dist/types/Bound.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Distribution } from "./Distribution";
|
|
1
|
+
import type { Distribution } from "./Distribution/index.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Canonical endpoint stored on `[Meta].whereby`. Call sites still accept a
|
|
4
4
|
* scalar (inclusive) via {@link InputBound}; `.whereby()` runs {@link toBound} so
|