@mark1russell7/layout-contract 0.4.0 → 0.5.0
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/README.md +1 -1
- package/build/index.d.ts +53 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +114 -9
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/strategy-catalog.ts +140 -10
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The package has one runtime dependency: `@mark1russell7/rigor-generators`, the h
|
|
|
30
30
|
| The strategy space | `StrategySpace`, `SpaceStage`, `StageOption`, `OptionSupports`, `ShapeFilter`, `SpaceParam`, `ParamWhen`, `MemberRule`, `SpaceConstraint`, `OptionRef`, `StrategyConfig`, `StageChoice`, `ParamKind`, `ParamValue`, `STRATEGY_SPACE_SCHEMA` |
|
|
31
31
|
| The space functions | `checkSpace`, `checkConfig`, `canonicalConfig`, `configId`, `spaceSize`, `spaceShapeKinds`, `paramLevels`, `enumerateSpace`, `productSpace`, `joinConfigs`, `splitConfig`, `SpaceSize`, `SpaceSizeOptions`, `EnumerateOptions`, `GridOptions`, `SampleOptions` |
|
|
32
32
|
| The option declarations | `OptionSchema`, `OptionDeclaration`, `AnyOption`, `NumberOption`, `BooleanOption`, `EnumOption`, `ValueOption`, `ListItem`, `NoDefault`, `DeclaredStrategy`, `listOptions`, `optionDefaults`, `checkOptions`, `clampOptions`, `sweepValues`, `sweepOf`, `sweepGrid`, `checkSchema` |
|
|
33
|
-
| The strategy catalog | `StrategyCatalog`, `StrategyCatalogSource`, `CatalogEntry`, `ParamRoute`, `StrategyMember`, `CatalogLimit`, `STRATEGY_CATALOG_SCHEMA`, `NODE_POSITIONS_DIMENSION`, `parseStrategyCatalog`, `writeStrategyCatalog`, `checkCatalog`, `catalogDefaults`, `catalogOptions`, `catalogChoices`, `catalogKey`, `decodeOptionValue`, `encodeOptionValue` |
|
|
33
|
+
| The strategy catalog | `StrategyCatalog`, `StrategyCatalogSource`, `CatalogEntry`, `ParamRoute`, `StrategyMember`, `CatalogLimit`, `OutputRow`, `OutputEvidence`, `OutputGridClass`, `OutputGridCounts`, `StrategyCatalogSchema`, `STRATEGY_CATALOG_SCHEMA`, `STRATEGY_CATALOG_SCHEMAS`, `OUTPUT_GRID_PROPERTIES`, `OUTPUT_NEAR_WHOLE`, `OUTPUT_CLASS_MIN_INPUTS`, `NODE_POSITIONS_DIMENSION`, `outputGridClass`, `parseStrategyCatalog`, `writeStrategyCatalog`, `checkCatalog`, `catalogDefaults`, `catalogOptions`, `catalogChoices`, `catalogKey`, `decodeOptionValue`, `encodeOptionValue` |
|
|
34
34
|
| The turn | `turnBox`, `turnPort`, `turnMargin`, `turnRegion`, `turnSide`, `turnPoint` |
|
|
35
35
|
| The tolerances | `EPS`, `RECORD_EPS`, `RECORD_SCALE`, `Tolerance`, `DEFAULT_TOLERANCE` |
|
|
36
36
|
| The hard rules | `HARD_RULE_VERSION`, `shapesOverlap`, `circleOverlaps`, `circlesOutside`, `placedCircle`, `PlacedCircle`, `countOverlaps`, `countObstacleHits`, `regionHitsRect`, `rectInRegion`, `countOutside`, `ContainerTest`, `countPortsOffBorder`, `packHard`, `PackHard`, `PACK_HARD_RULES`, `placedRect`, `checkInput` |
|
package/build/index.d.ts
CHANGED
|
@@ -1046,8 +1046,12 @@ export declare function declarationIssues(key: string, d: AnyOption): string[];
|
|
|
1046
1046
|
* A good schema gives an empty list.
|
|
1047
1047
|
*/
|
|
1048
1048
|
export declare function checkSchema(strategy: DeclaredStrategy): string[];
|
|
1049
|
-
/** The schema of a strategy catalog. A new field is a new version of the schema. */
|
|
1050
|
-
export declare const STRATEGY_CATALOG_SCHEMA = "strategy-catalog/
|
|
1049
|
+
/** The newest schema of a strategy catalog. A new field is a new version of the schema. */
|
|
1050
|
+
export declare const STRATEGY_CATALOG_SCHEMA = "strategy-catalog/2";
|
|
1051
|
+
/** The schemas that `parseStrategyCatalog` reads, oldest first. Schema 2 adds the field `output` of an entry. */
|
|
1052
|
+
export declare const STRATEGY_CATALOG_SCHEMAS: readonly ["strategy-catalog/1", "strategy-catalog/2"];
|
|
1053
|
+
/** The name of one schema of a strategy catalog. */
|
|
1054
|
+
export type StrategyCatalogSchema = (typeof STRATEGY_CATALOG_SCHEMAS)[number];
|
|
1051
1055
|
/**
|
|
1052
1056
|
* The dimension of `supports` that tells who owns the positions of the nodes. The value `host` means that the strategy keeps the positions that the host gives.
|
|
1053
1057
|
* The value `engine` means that the strategy can set them. A strategy that moves nodes has only `engine`. A `SupportProbe` tests the claim with a run.
|
|
@@ -1064,6 +1068,48 @@ export interface CatalogLimit {
|
|
|
1064
1068
|
}
|
|
1065
1069
|
/** The kind of a strategy: it places on its own, it wraps other strategies, or it is for one shape of item. */
|
|
1066
1070
|
export type StrategyKind = "single" | "composite" | "shape";
|
|
1071
|
+
/** The output properties that tell if the numbers of a result are whole: the positions and the sizes. The parser examines the class of these properties. */
|
|
1072
|
+
export declare const OUTPUT_GRID_PROPERTIES: readonly string[];
|
|
1073
|
+
/** The class of a grid property of an output. */
|
|
1074
|
+
export type OutputGridClass = "whole" | "near-whole" | "fractional" | "untested";
|
|
1075
|
+
/** The largest distance from a whole number for a near-whole value. A value at a larger distance is fractional. */
|
|
1076
|
+
export declare const OUTPUT_NEAR_WHOLE = 1e-9;
|
|
1077
|
+
/** The fewest packed inputs for the class `whole` or `near-whole`. A fraction needs no such count, because one counterexample is a proof. */
|
|
1078
|
+
export declare const OUTPUT_CLASS_MIN_INPUTS = 30;
|
|
1079
|
+
/** What one read of an output covers. The row states no promise beyond this evidence. */
|
|
1080
|
+
export interface OutputEvidence {
|
|
1081
|
+
/** The count of inputs that the strategy packed in this read. */
|
|
1082
|
+
readonly inputs: number;
|
|
1083
|
+
/** The count of inputs with a fractional value of the property. A grid property must have this field. */
|
|
1084
|
+
readonly fractionalInputs?: number;
|
|
1085
|
+
/** The count of inputs with a near-whole value and no fractional value of the property. A grid property must have this field. */
|
|
1086
|
+
readonly nearWholeInputs?: number;
|
|
1087
|
+
/** The input family or the study of the read. */
|
|
1088
|
+
readonly source: string;
|
|
1089
|
+
/** The name of the options of the read, for example `default`. */
|
|
1090
|
+
readonly optionSet: string;
|
|
1091
|
+
/** The version of the catalog that the read used. */
|
|
1092
|
+
readonly catalogVersion: string;
|
|
1093
|
+
}
|
|
1094
|
+
/** One property of the output of a strategy, as a read found it. An entry has one row for each pair of `property` and `optionSet`. */
|
|
1095
|
+
export interface OutputRow {
|
|
1096
|
+
/** The property, for example `position-grid`. */
|
|
1097
|
+
readonly property: string;
|
|
1098
|
+
/** The class of the property. For a grid property, `outputGridClass` gives the only class that the evidence permits. */
|
|
1099
|
+
readonly class: string;
|
|
1100
|
+
readonly evidence: OutputEvidence;
|
|
1101
|
+
}
|
|
1102
|
+
/** The counts that decide the class of a grid property. */
|
|
1103
|
+
export interface OutputGridCounts {
|
|
1104
|
+
readonly inputs: number;
|
|
1105
|
+
readonly fractionalInputs: number;
|
|
1106
|
+
readonly nearWholeInputs: number;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* This function gives the class of a grid property from its counts. One fractional input gives `fractional` at any count.
|
|
1110
|
+
* With no fraction, fewer than `OUTPUT_CLASS_MIN_INPUTS` inputs give `untested`. Each other read gives `near-whole` or `whole`.
|
|
1111
|
+
*/
|
|
1112
|
+
export declare function outputGridClass(counts: OutputGridCounts): OutputGridClass;
|
|
1067
1113
|
/** One strategy of a catalog. */
|
|
1068
1114
|
export interface CatalogEntry {
|
|
1069
1115
|
/** The key is unique in the catalog: `<step>/<id>` with a step, else `id`. */
|
|
@@ -1089,6 +1135,8 @@ export interface CatalogEntry {
|
|
|
1089
1135
|
readonly optIn: boolean;
|
|
1090
1136
|
/** The value `true` tells that the strategy is a baseline of a bench. It has `optIn` true, and a chooser does not offer it. */
|
|
1091
1137
|
readonly baseline?: true;
|
|
1138
|
+
/** The reads of the output of the strategy. A file with this field has the schema 2. */
|
|
1139
|
+
readonly output?: readonly OutputRow[];
|
|
1092
1140
|
/** The declarations of the options, in the order of a form. */
|
|
1093
1141
|
readonly options: Readonly<Record<string, AnyOption>>;
|
|
1094
1142
|
}
|
|
@@ -1100,7 +1148,7 @@ export interface StrategyCatalogSource {
|
|
|
1100
1148
|
}
|
|
1101
1149
|
/** A catalog document: the form that `writeStrategyCatalog` writes and `parseStrategyCatalog` reads. */
|
|
1102
1150
|
export interface StrategyCatalog extends StrategyCatalogSource {
|
|
1103
|
-
readonly schema:
|
|
1151
|
+
readonly schema: StrategyCatalogSchema;
|
|
1104
1152
|
/** The npm version of the engine. */
|
|
1105
1153
|
readonly version: string;
|
|
1106
1154
|
}
|
|
@@ -1193,7 +1241,7 @@ export declare function catalogKey(id: string, step?: string): string;
|
|
|
1193
1241
|
*/
|
|
1194
1242
|
export declare function catalogChoices(strategies: readonly CatalogEntry[], declaration?: AnyOption | ListItem): readonly CatalogEntry[];
|
|
1195
1243
|
/**
|
|
1196
|
-
* This function reads a catalog from parsed JSON
|
|
1244
|
+
* This function reads a catalog from parsed JSON, in each schema of `STRATEGY_CATALOG_SCHEMAS`. It refuses each unknown field and each other schema.
|
|
1197
1245
|
* It gives the catalog with its `Infinity` values restored, or the list of all faults.
|
|
1198
1246
|
*/
|
|
1199
1247
|
export declare function parseStrategyCatalog(value: unknown): StrategyCatalogParse;
|
|
@@ -1206,6 +1254,7 @@ export declare function decodeOptionValue(value: unknown, declaration: AnyOption
|
|
|
1206
1254
|
export declare function encodeOptionValue(value: unknown, declaration: AnyOption | ListItem): unknown;
|
|
1207
1255
|
/**
|
|
1208
1256
|
* This function gives the text of the catalog file, sorted by key. The same source and version give the same bytes.
|
|
1257
|
+
* The file has the oldest schema that holds it, so a catalog with no `output` stays valid for a reader of the schema 1.
|
|
1209
1258
|
* The caller gives the version from `package.json`. The function throws an error if the file breaks a rule of the format.
|
|
1210
1259
|
*/
|
|
1211
1260
|
export declare function writeStrategyCatalog(source: StrategyCatalogSource, version: string): string;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/strategy-options.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;qBACa;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBCzBf;WACN;WACA;WACA;WACA;;;iBAIM;WACN;WACA;WACA,WAAW,SAAS;;;iBAId;WACN,qBAAqB;;WAErB;;WAEA;aAAiB;aAAoB;;;WAErC;aAA2B;aAAqB;aAAoB;;WACpE,iBAAiB;;;;;;;wBAQZ,UAAU,OAAO,aAAa,QAAQ,aAAa;;YC/BvD;;iBAGK;WACN;WACA,OAAO;WACP;WACA;;WAEA,SAAS,SAAS;WAClB;;WAEA;;WAEA;WACA;WACA;WACA;WACA;;WAEA,kBAAkB;;WAElB,UAAU,SAAS;;WAEnB,MAAM,SAAS;;WAEf,YAAY,SAAS,QAAQ;;WAE7B;;;;;WAKA;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA,MAAM;;WAEN;WACA;;;;;;YAOC,WAAW,SAAS;;iBAGf;WACN;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;YAIC,WAAW,KAAK;;;;;wBAMZ,eAAe,OAAO,aAAa,KAAK,WAAW;;;;;wBAkDnD,WAAW,QAAQ,KAAK;;;;;;wBASxB,kBAAkB;;;;;;wBAkClB,kBAAkB,iBAAiB;;wBCxLnC,WAAW,KAAK,YAAY;;;;;;;qBAa/B;;iBAGI;WACN;WACA;WACA;;;wBAIK,aAAa,KAAK,YAAY;;;;;;;;;wBA2B9B,cAAc,GAAG,WAAW,GAAG,WAAW,oBAA+C;;;;;;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,WAAW,MAAM,kBAAkB,YAAY,EAAE,KAAK;;iBAG1G,iBAAiB,2BAA2B;;WAElD;WACA,UAAU;WACV,SAAS,aAAa,GAAG;;;iBAInB;;WAEN;WACA;;WAEA;;WAEA;;;iBAIM,cAAc;;WAEpB;WACA,SAAS,QAAQ;;;iBAIX;;;;;WAKN;;WAEA;;;wBAYK,YAAY,kBAAkB,2BAC5C,UAAU,iBAAiB,GAAG;WAClB,WAAW;WAAqB,aAAa,UAAU;WAAa;;;;;;wBASlE,eAAe,kBAAkB,2BAA2B,UAAU,iBAAiB,GAAG,KAAK,QAAQ;;wBAevG,YAAY,aAAa,gBAAgB,GAAG,YAAY;;;;;;;wBAiCxD,aAAa,kBAAkB,UAAU,iBAAiB,IAAI,SAAS,QAAQ,KAAK;;;;;wBAgBpF,aAAa,kBAAkB,UAAU,iBAAiB,IAAI,SAAS,QAAQ,KAAK,QAAQ;;;;;;wBAwC5F,YAAY,aAAa,WAAW,UAAS;;;;;wBA6B7C,QAAQ,kBAAkB,UAAU,iBAAiB,IAAI,WAAW,YAAY,UAAS,eAAoB,cAAc;;;;;wBAQ3H,UAAU,kBAAkB,UAAU,iBAAiB,IAAI,sBAAsB,eAAe,UAAS,eAAoB,cAAc;;wBAU3I,kBAAkB,aAAa,GAAG;;;;;;wBA8BlC,YAAY,UAAU;;qBCxWzB;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/strategy-options.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;qBACa;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBCzBf;WACN;WACA;WACA;WACA;;;iBAIM;WACN;WACA;WACA,WAAW,SAAS;;;iBAId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;;;;wBA+FxC,YAAY,KAAK,YAAY;;wBAa7B,cAAc,KAAK,YAAY;;;;;;wBAsB/B,SAAS,KAAK,iBAAiB,iBAAiB;;;;;;;;wBAsChD,kBACd,qBAAqB,mBACrB,OAAM,SAAS,eAAe,cAC9B,gBACA,cACC;;wBA8Ha,qBAAqB,IAAI,aAAa,WAAU,SAAS,aAAa,MAAW,eAAe;;iBA2G/F;WACN;WACA;;WAEA;WACA;;WAEA,qBAAqB;;WAErB;WACA,aAAa;;WAEb,cAAc,MAAM;;EAE7B,MAAM,OAAO,aAAa,cAAc,MAAM,kBAAkB;;;iBAIjD;;WAEN;;WAEA;WACA;;WAEA,QAAQ,OAAO;;;;;;;wBAWV,cAAc,MAAM,aAAa,cAAc,gBAAgB,cAAc,UAAS,iBAAsB,aAAa;;;;;qBA+D5H,YAAY;;;;qBA0BZ,eAAe;;;;;;qBAoBf,gBAAgB,aAAa"}
|
package/build/index.js
CHANGED
|
@@ -3921,13 +3921,30 @@ function checkSchema(strategy) {
|
|
|
3921
3921
|
return out;
|
|
3922
3922
|
}
|
|
3923
3923
|
// src/strategy-catalog.ts
|
|
3924
|
-
/** The schema of a strategy catalog. A new field is a new version of the schema. */
|
|
3925
|
-
const STRATEGY_CATALOG_SCHEMA = "strategy-catalog/
|
|
3924
|
+
/** The newest schema of a strategy catalog. A new field is a new version of the schema. */
|
|
3925
|
+
const STRATEGY_CATALOG_SCHEMA = "strategy-catalog/2";
|
|
3926
|
+
/** The schemas that `parseStrategyCatalog` reads, oldest first. Schema 2 adds the field `output` of an entry. */
|
|
3927
|
+
const STRATEGY_CATALOG_SCHEMAS = ["strategy-catalog/1", STRATEGY_CATALOG_SCHEMA];
|
|
3926
3928
|
/**
|
|
3927
3929
|
* The dimension of `supports` that tells who owns the positions of the nodes. The value `host` means that the strategy keeps the positions that the host gives.
|
|
3928
3930
|
* The value `engine` means that the strategy can set them. A strategy that moves nodes has only `engine`. A `SupportProbe` tests the claim with a run.
|
|
3929
3931
|
*/
|
|
3930
3932
|
const NODE_POSITIONS_DIMENSION = "nodePositions";
|
|
3933
|
+
/** The output properties that tell if the numbers of a result are whole: the positions and the sizes. The parser examines the class of these properties. */
|
|
3934
|
+
const OUTPUT_GRID_PROPERTIES = ["position-grid", "size-grid"];
|
|
3935
|
+
/** The largest distance from a whole number for a near-whole value. A value at a larger distance is fractional. */
|
|
3936
|
+
const OUTPUT_NEAR_WHOLE = 1e-9;
|
|
3937
|
+
/** The fewest packed inputs for the class `whole` or `near-whole`. A fraction needs no such count, because one counterexample is a proof. */
|
|
3938
|
+
const OUTPUT_CLASS_MIN_INPUTS = 30;
|
|
3939
|
+
/**
|
|
3940
|
+
* This function gives the class of a grid property from its counts. One fractional input gives `fractional` at any count.
|
|
3941
|
+
* With no fraction, fewer than `OUTPUT_CLASS_MIN_INPUTS` inputs give `untested`. Each other read gives `near-whole` or `whole`.
|
|
3942
|
+
*/
|
|
3943
|
+
function outputGridClass(counts) {
|
|
3944
|
+
if (counts.fractionalInputs > 0) return "fractional";
|
|
3945
|
+
if (counts.inputs < 30) return "untested";
|
|
3946
|
+
return counts.nearWholeInputs > 0 ? "near-whole" : "whole";
|
|
3947
|
+
}
|
|
3931
3948
|
const STRATEGY_KINDS = [
|
|
3932
3949
|
"single",
|
|
3933
3950
|
"composite",
|
|
@@ -3959,6 +3976,7 @@ const ENTRY_FIELDS = [
|
|
|
3959
3976
|
"determinismNote",
|
|
3960
3977
|
"optIn",
|
|
3961
3978
|
"baseline",
|
|
3979
|
+
"output",
|
|
3962
3980
|
"options"
|
|
3963
3981
|
];
|
|
3964
3982
|
const COMMON_FIELDS = [
|
|
@@ -4003,6 +4021,19 @@ const LIST_FIELDS = [
|
|
|
4003
4021
|
"min",
|
|
4004
4022
|
"max"
|
|
4005
4023
|
];
|
|
4024
|
+
const ROW_FIELDS = [
|
|
4025
|
+
"property",
|
|
4026
|
+
"class",
|
|
4027
|
+
"evidence"
|
|
4028
|
+
];
|
|
4029
|
+
const EVIDENCE_FIELDS = [
|
|
4030
|
+
"inputs",
|
|
4031
|
+
"fractionalInputs",
|
|
4032
|
+
"nearWholeInputs",
|
|
4033
|
+
"source",
|
|
4034
|
+
"optionSet",
|
|
4035
|
+
"catalogVersion"
|
|
4036
|
+
];
|
|
4006
4037
|
/** The fields of a declaration, in the order of the file. */
|
|
4007
4038
|
const OPTION_ORDER = [
|
|
4008
4039
|
"type",
|
|
@@ -4256,8 +4287,61 @@ function checkLimits(at, limits, faults) {
|
|
|
4256
4287
|
if (isFiniteNumber(raw["min"]) && isFiniteNumber(raw["max"]) && raw["min"] > raw["max"]) faults.push(`${place}: "min" is more than "max".`);
|
|
4257
4288
|
}
|
|
4258
4289
|
}
|
|
4290
|
+
/** This function adds the faults of the evidence of one output row. */
|
|
4291
|
+
function checkEvidence(at, property, rowClass, raw, faults) {
|
|
4292
|
+
if (!isFields(raw)) {
|
|
4293
|
+
faults.push(`${at}: "evidence" is not an object.`);
|
|
4294
|
+
return;
|
|
4295
|
+
}
|
|
4296
|
+
refuseUnknown(`${at}: the evidence`, raw, EVIDENCE_FIELDS, faults);
|
|
4297
|
+
for (const f of [
|
|
4298
|
+
"source",
|
|
4299
|
+
"optionSet",
|
|
4300
|
+
"catalogVersion"
|
|
4301
|
+
]) if (!isText(raw[f])) faults.push(`${at}: the evidence field "${f}" is not a text.`);
|
|
4302
|
+
const count = (v) => Number.isInteger(v) && v >= 0;
|
|
4303
|
+
if (!count(raw["inputs"])) faults.push(`${at}: the evidence field "inputs" is not a count.`);
|
|
4304
|
+
const grid = OUTPUT_GRID_PROPERTIES.includes(property);
|
|
4305
|
+
for (const f of ["fractionalInputs", "nearWholeInputs"]) if (grid ? !count(raw[f]) : raw[f] !== void 0 && !count(raw[f])) faults.push(`${at}: the evidence field "${f}" is not a count.`);
|
|
4306
|
+
const [inputs, fractionalInputs, nearWholeInputs] = [
|
|
4307
|
+
raw["inputs"],
|
|
4308
|
+
raw["fractionalInputs"],
|
|
4309
|
+
raw["nearWholeInputs"]
|
|
4310
|
+
];
|
|
4311
|
+
if (!grid || !count(inputs) || !count(fractionalInputs) || !count(nearWholeInputs)) return;
|
|
4312
|
+
if (fractionalInputs + nearWholeInputs > inputs) faults.push(`${at}: the fractional and near-whole counts are more than the inputs.`);
|
|
4313
|
+
const expected = outputGridClass({
|
|
4314
|
+
inputs,
|
|
4315
|
+
fractionalInputs,
|
|
4316
|
+
nearWholeInputs
|
|
4317
|
+
});
|
|
4318
|
+
if (rowClass !== expected) faults.push(`${at}: the evidence gives the class "${expected}".`);
|
|
4319
|
+
}
|
|
4320
|
+
/** This function adds the faults of the field `output` of one entry. */
|
|
4321
|
+
function checkOutput(at, raw, schema, faults) {
|
|
4322
|
+
if (schema === STRATEGY_CATALOG_SCHEMAS[0]) faults.push(`${at}: the field "output" needs the schema ${STRATEGY_CATALOG_SCHEMA}.`);
|
|
4323
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
4324
|
+
faults.push(`${at}: "output" is not a list with rows.`);
|
|
4325
|
+
return;
|
|
4326
|
+
}
|
|
4327
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4328
|
+
raw.forEach((row, i) => {
|
|
4329
|
+
const place = `${at}: the output row ${i}`;
|
|
4330
|
+
if (!isFields(row)) {
|
|
4331
|
+
faults.push(`${place} is not an object.`);
|
|
4332
|
+
return;
|
|
4333
|
+
}
|
|
4334
|
+
refuseUnknown(place, row, ROW_FIELDS, faults);
|
|
4335
|
+
for (const f of ["property", "class"]) if (!isText(row[f])) faults.push(`${place}: "${f}" is not a text.`);
|
|
4336
|
+
checkEvidence(place, row["property"], row["class"], row["evidence"], faults);
|
|
4337
|
+
const optionSet = isFields(row["evidence"]) ? row["evidence"]["optionSet"] : void 0;
|
|
4338
|
+
const name = JSON.stringify([row["property"], optionSet]);
|
|
4339
|
+
if (seen.has(name)) faults.push(`${place}: the property and the option set are not unique.`);
|
|
4340
|
+
seen.add(name);
|
|
4341
|
+
});
|
|
4342
|
+
}
|
|
4259
4343
|
/** This function restores one entry of a file. */
|
|
4260
|
-
function readEntry(at, raw, faults) {
|
|
4344
|
+
function readEntry(at, raw, schema, faults) {
|
|
4261
4345
|
if (!isFields(raw)) {
|
|
4262
4346
|
faults.push(`${at} is not an object.`);
|
|
4263
4347
|
return;
|
|
@@ -4278,6 +4362,7 @@ function readEntry(at, raw, faults) {
|
|
|
4278
4362
|
if (raw["baseline"] === true && raw["optIn"] !== true) faults.push(`${at}: a baseline has "optIn" true.`);
|
|
4279
4363
|
if (!isFields(raw["supports"]) || !Object.values(raw["supports"]).every(isTextList)) faults.push(`${at}: "supports" is not a record of text lists.`);
|
|
4280
4364
|
checkLimits(at, raw["limits"], faults);
|
|
4365
|
+
if (raw["output"] !== void 0) checkOutput(at, raw["output"], schema, faults);
|
|
4281
4366
|
if (isText(raw["id"]) && raw["key"] !== catalogKey(raw["id"], raw["step"])) faults.push(`${at}: the key does not follow from "step" and "id".`);
|
|
4282
4367
|
if (!isFields(raw["options"])) {
|
|
4283
4368
|
faults.push(`${at}: "options" is not an object.`);
|
|
@@ -4310,6 +4395,7 @@ function readEntry(at, raw, faults) {
|
|
|
4310
4395
|
...determinismNote === void 0 ? {} : { determinismNote },
|
|
4311
4396
|
optIn: raw["optIn"],
|
|
4312
4397
|
...raw["baseline"] === true ? { baseline: true } : {},
|
|
4398
|
+
...raw["output"] === void 0 ? {} : { output: raw["output"] },
|
|
4313
4399
|
options
|
|
4314
4400
|
};
|
|
4315
4401
|
}
|
|
@@ -4365,7 +4451,7 @@ function checkReferences(entries, faults) {
|
|
|
4365
4451
|
}
|
|
4366
4452
|
}
|
|
4367
4453
|
/**
|
|
4368
|
-
* This function reads a catalog from parsed JSON
|
|
4454
|
+
* This function reads a catalog from parsed JSON, in each schema of `STRATEGY_CATALOG_SCHEMAS`. It refuses each unknown field and each other schema.
|
|
4369
4455
|
* It gives the catalog with its `Infinity` values restored, or the list of all faults.
|
|
4370
4456
|
*/
|
|
4371
4457
|
function parseStrategyCatalog(value) {
|
|
@@ -4375,7 +4461,8 @@ function parseStrategyCatalog(value) {
|
|
|
4375
4461
|
faults: ["The catalog is not an object."]
|
|
4376
4462
|
};
|
|
4377
4463
|
refuseUnknown("The catalog", value, TOP_FIELDS, faults);
|
|
4378
|
-
|
|
4464
|
+
const schema = value["schema"];
|
|
4465
|
+
if (!STRATEGY_CATALOG_SCHEMAS.includes(schema)) faults.push(`The schema is not one of ${STRATEGY_CATALOG_SCHEMAS.join(", ")}.`);
|
|
4379
4466
|
if (!isText(value["engine"])) faults.push(`"engine" is not a text.`);
|
|
4380
4467
|
if (!isText(value["version"])) faults.push(`"version" is not a text.`);
|
|
4381
4468
|
if (!Array.isArray(value["strategies"])) return {
|
|
@@ -4384,7 +4471,7 @@ function parseStrategyCatalog(value) {
|
|
|
4384
4471
|
};
|
|
4385
4472
|
const entries = [];
|
|
4386
4473
|
value["strategies"].forEach((raw, i) => {
|
|
4387
|
-
const entry = readEntry(`The strategy ${isFields(raw) && isText(raw["key"]) ? raw["key"] : i}`, raw, faults);
|
|
4474
|
+
const entry = readEntry(`The strategy ${isFields(raw) && isText(raw["key"]) ? raw["key"] : i}`, raw, schema, faults);
|
|
4388
4475
|
if (entry !== void 0) entries.push(entry);
|
|
4389
4476
|
});
|
|
4390
4477
|
for (let i = 1; i < entries.length; i++) {
|
|
@@ -4400,7 +4487,7 @@ function parseStrategyCatalog(value) {
|
|
|
4400
4487
|
return {
|
|
4401
4488
|
ok: true,
|
|
4402
4489
|
catalog: {
|
|
4403
|
-
schema
|
|
4490
|
+
schema,
|
|
4404
4491
|
engine: value["engine"],
|
|
4405
4492
|
version: value["version"],
|
|
4406
4493
|
strategies: entries
|
|
@@ -4446,6 +4533,22 @@ function writeOption(option) {
|
|
|
4446
4533
|
}
|
|
4447
4534
|
return out;
|
|
4448
4535
|
}
|
|
4536
|
+
/** This function gives the file form of one output row, with the fields in the order of the file. */
|
|
4537
|
+
function writeRow(row) {
|
|
4538
|
+
const e = row.evidence;
|
|
4539
|
+
return {
|
|
4540
|
+
property: row.property,
|
|
4541
|
+
class: row.class,
|
|
4542
|
+
evidence: {
|
|
4543
|
+
inputs: e.inputs,
|
|
4544
|
+
...e.fractionalInputs === void 0 ? {} : { fractionalInputs: e.fractionalInputs },
|
|
4545
|
+
...e.nearWholeInputs === void 0 ? {} : { nearWholeInputs: e.nearWholeInputs },
|
|
4546
|
+
source: e.source,
|
|
4547
|
+
optionSet: e.optionSet,
|
|
4548
|
+
catalogVersion: e.catalogVersion
|
|
4549
|
+
}
|
|
4550
|
+
};
|
|
4551
|
+
}
|
|
4449
4552
|
/** This function gives the file form of an entry, with its fields in the order of the file. */
|
|
4450
4553
|
function writeEntry(e) {
|
|
4451
4554
|
const options = Object.fromEntries(Object.entries(e.options).map(([key, o]) => [key, writeOption(o)]));
|
|
@@ -4462,6 +4565,7 @@ function writeEntry(e) {
|
|
|
4462
4565
|
...e.determinismNote === void 0 ? {} : { determinismNote: e.determinismNote },
|
|
4463
4566
|
optIn: e.optIn,
|
|
4464
4567
|
...e.baseline === true ? { baseline: true } : {},
|
|
4568
|
+
...e.output === void 0 ? {} : { output: e.output.map(writeRow) },
|
|
4465
4569
|
options
|
|
4466
4570
|
};
|
|
4467
4571
|
}
|
|
@@ -4475,12 +4579,13 @@ function unsafeValues(v, at) {
|
|
|
4475
4579
|
}
|
|
4476
4580
|
/**
|
|
4477
4581
|
* This function gives the text of the catalog file, sorted by key. The same source and version give the same bytes.
|
|
4582
|
+
* The file has the oldest schema that holds it, so a catalog with no `output` stays valid for a reader of the schema 1.
|
|
4478
4583
|
* The caller gives the version from `package.json`. The function throws an error if the file breaks a rule of the format.
|
|
4479
4584
|
*/
|
|
4480
4585
|
function writeStrategyCatalog(source, version) {
|
|
4481
4586
|
const strategies = [...source.strategies].sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0).map(writeEntry);
|
|
4482
4587
|
const doc = {
|
|
4483
|
-
schema: STRATEGY_CATALOG_SCHEMA,
|
|
4588
|
+
schema: source.strategies.some((e) => e.output !== void 0) ? STRATEGY_CATALOG_SCHEMA : STRATEGY_CATALOG_SCHEMAS[0],
|
|
4484
4589
|
engine: source.engine,
|
|
4485
4590
|
version,
|
|
4486
4591
|
strategies
|
|
@@ -5737,6 +5842,6 @@ const RECT_SCATTERED = /* @__PURE__ */ Object.freeze({
|
|
|
5737
5842
|
};
|
|
5738
5843
|
}
|
|
5739
5844
|
});
|
|
5740
|
-
export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CORPUS_DIMENSIONS, DEFAULT_FAMILY_BY, DEFAULT_RNG, DEFAULT_SHAPES, DEFAULT_TOLERANCE, EDGES_STEP, EDGE_DENSITY, EDGE_KEY_STEP, EDGE_KEY_STEP_VERSION, EDGE_STEP_VERSION, EPS, FAMILY_ANY_KIND, HARD_RULE_VERSION, INVALIDATED_FIELD, JOINT_MEASURES, JOINT_MOVED_MIN, NODE_POSITIONS_DIMENSION, PACK_HARD_RULES, RECORD_EPS, RECORD_SCALE, RECT_SCATTERED, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, STRATEGY_CATALOG_SCHEMA, STRATEGY_SPACE_SCHEMA, VERDICT_DRAWS, VERDICT_EXACT_CAP, VERDICT_EXACT_MAX, VERDICT_RUNS, VERDICT_SEED, applyPack, balanceMeasureSpecs, balanceMeasures, balanceOf, boundsOf, boxArea, canonicalConfig, canonicalInput, canonicalJson, catalogChoices, catalogDefaults, catalogKey, catalogOptions, checkCatalog, checkConfig, checkDeclared, checkInput, checkLayoutRecord, checkOptions, checkSchema, checkShapes, checkSpace, checkSplit, circleOverlaps, circlesOutside, clampOptions, compareMeasure, composeFamily, configId, corpusHashOf, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, dimensionAt, dimensionSupports, dimensionUnit, documentHash, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fnv1a32, grow, hardRuleOf, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, levelsOf, listOptions, marginSides, minEffectOf, mulberry32, nearestGaps, optionDefaults, optionIssue, outputGroups, outputHash, overlapOf, ownerDimension, packHard, packLinks, paramActive, paramLevels, paramProblem, paramValue, parseLayoutRecord, parseStrategyCatalog, perChange, pickMoves, placedCircle, placedRect, pointSegmentDistance, portPoint, portfolio, procrustesOf, productSpace, randomInt, rectInRegion, regionArea, regionHitsRect, resolveDimensions, ruleLevel, segmentsCross, selectBest, sha256Hex, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, shapesOverlap, sharedDimension, spaceShapeKinds, spaceSize, splitConfig, splitFileName, splitFolds, stepRandom, sweepGrid, sweepOf, sweepValues, toLayoutRecord, toPackInput, toRect, toSizedRect, translate, turnBox, turnMargin, turnPoint, turnPort, turnRegion, turnSide, verdict, writeStrategyCatalog };
|
|
5845
|
+
export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CORPUS_DIMENSIONS, DEFAULT_FAMILY_BY, DEFAULT_RNG, DEFAULT_SHAPES, DEFAULT_TOLERANCE, EDGES_STEP, EDGE_DENSITY, EDGE_KEY_STEP, EDGE_KEY_STEP_VERSION, EDGE_STEP_VERSION, EPS, FAMILY_ANY_KIND, HARD_RULE_VERSION, INVALIDATED_FIELD, JOINT_MEASURES, JOINT_MOVED_MIN, NODE_POSITIONS_DIMENSION, OUTPUT_CLASS_MIN_INPUTS, OUTPUT_GRID_PROPERTIES, OUTPUT_NEAR_WHOLE, PACK_HARD_RULES, RECORD_EPS, RECORD_SCALE, RECT_SCATTERED, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, STRATEGY_CATALOG_SCHEMA, STRATEGY_CATALOG_SCHEMAS, STRATEGY_SPACE_SCHEMA, VERDICT_DRAWS, VERDICT_EXACT_CAP, VERDICT_EXACT_MAX, VERDICT_RUNS, VERDICT_SEED, applyPack, balanceMeasureSpecs, balanceMeasures, balanceOf, boundsOf, boxArea, canonicalConfig, canonicalInput, canonicalJson, catalogChoices, catalogDefaults, catalogKey, catalogOptions, checkCatalog, checkConfig, checkDeclared, checkInput, checkLayoutRecord, checkOptions, checkSchema, checkShapes, checkSpace, checkSplit, circleOverlaps, circlesOutside, clampOptions, compareMeasure, composeFamily, configId, corpusHashOf, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, dimensionAt, dimensionSupports, dimensionUnit, documentHash, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fnv1a32, grow, hardRuleOf, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, levelsOf, listOptions, marginSides, minEffectOf, mulberry32, nearestGaps, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, overlapOf, ownerDimension, packHard, packLinks, paramActive, paramLevels, paramProblem, paramValue, parseLayoutRecord, parseStrategyCatalog, perChange, pickMoves, placedCircle, placedRect, pointSegmentDistance, portPoint, portfolio, procrustesOf, productSpace, randomInt, rectInRegion, regionArea, regionHitsRect, resolveDimensions, ruleLevel, segmentsCross, selectBest, sha256Hex, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, shapesOverlap, sharedDimension, spaceShapeKinds, spaceSize, splitConfig, splitFileName, splitFolds, stepRandom, sweepGrid, sweepOf, sweepValues, toLayoutRecord, toPackInput, toRect, toSizedRect, translate, turnBox, turnMargin, turnPoint, turnPort, turnRegion, turnSide, verdict, writeStrategyCatalog };
|
|
5741
5846
|
|
|
5742
5847
|
//# sourceMappingURL=index.js.map
|