@mark1russell7/layout-contract 0.5.4 → 0.5.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/build/index.d.ts CHANGED
@@ -481,17 +481,45 @@ export interface HashOptions {
481
481
  * The value `0` keeps the exact numbers. A negative value or a value that is not finite causes a `RangeError`.
482
482
  */
483
483
  readonly grid?: number;
484
+ /**
485
+ * The names of the fields that the hash does not read, at each depth. Use it for report fields, for example a trace or a time.
486
+ * A field with one of these names is out of the form in each object of the value, also in an object in a list.
487
+ */
488
+ readonly skip?: readonly string[];
484
489
  }
485
490
  /**
486
491
  * This function gives the hash of an output: the first 16 hex characters of the SHA-256 of its canonical form.
487
492
  * Before the canonical form, each number goes to the nearest point of the grid, and `-0` becomes `0`.
488
493
  * With the default grid, the rounding is `round3` of `packing`: `Math.round(x * 1000) / 1000`.
489
- * The function throws a `RangeError` for `NaN` and for an infinite number.
494
+ * The function throws a `RangeError` for `NaN` and for an infinite number. The fields of `options.skip` are out of the form.
490
495
  *
491
496
  * The grid can split two outputs. Two numbers near a rounding boundary can go to two different points.
492
497
  * The grid can also merge two outputs whose numbers go to the same points. This merge is intentional: it removes the noise of floating-point numbers.
493
498
  */
494
499
  export declare function outputHash(value: unknown, options?: HashOptions): string;
500
+ /**
501
+ * This function gives the normal form of the output of a packer, for a fingerprint.
502
+ * The form has the placements, the overflow, the size and the moved obstacles. It does not have the trace.
503
+ * The placements, the moved obstacles and the overflow are in the order of their ids. A placement without `turn` gets `turn: 0`.
504
+ * Thus two packers with the same result in a different order have the same form.
505
+ * The function throws a `RangeError` when `placements`, `overflow` or `moved` has an id two times.
506
+ */
507
+ export declare function packOutputForm(output: PackOutput): unknown;
508
+ /** The hash of a probe that the strategy refused or does not support. It has no reason text, so a new text of a refusal does not change a fingerprint. */
509
+ export declare const REFUSED_PROBE = "refused";
510
+ /**
511
+ * This function gives the hash of one probe of a strategy. It calls `run` and gives `outputHash` of its result, with exact numbers by default.
512
+ * When `run` throws an error that `refused` accepts, the function gives `REFUSED_PROBE`. It throws each other error again.
513
+ * The option `grid` of `options` puts the numbers on a grid. Its default here is `0`, so a change in a number changes the hash.
514
+ */
515
+ export declare function probeHash(run: () => unknown, refused: (error: unknown) => boolean, options?: HashOptions): string;
516
+ /**
517
+ * This function gives the fingerprint of the outputs of one strategy: one hash of the hashes of its probes.
518
+ * The key of `hashes` is the id of a probe, and its value is the hash of the probe, from `probeHash`.
519
+ * The order of the keys does not change the fingerprint. A new probe, a probe less or a changed hash changes it.
520
+ * The function throws a `RangeError` when there is no probe.
521
+ */
522
+ export declare function fingerprintOf(hashes: Readonly<Record<string, string>>): string;
495
523
  /**
496
524
  * This function gives the hash of a document. It uses the rule of `outputHash`, but the form does not include the field `hash` of the document.
497
525
  * With the default grid, it is the input hash of `docs/FORMAT.md` of `packing`.
@@ -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;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBC5Bf;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;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,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;;;;;;;;;qBAuBf,kBAAkB,aAAa;;;;;;qBAqD/B,gBAAgB,aAAa"}
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;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;qBAOE,mBAAmB;;iBC5Bf;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;;;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AiB;;;;;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;;;;;;;;;qBAuBf,kBAAkB,aAAa;;;;;;qBAqD/B,gBAAgB,aAAa"}
package/build/index.js CHANGED
@@ -2339,7 +2339,7 @@ function gridFactor(options) {
2339
2339
  * This function gives a copy of a value with each number on the grid. The value `-0` becomes `0`.
2340
2340
  * It throws a `RangeError` for a number that is not finite.
2341
2341
  */
2342
- function onGrid(value, path, k) {
2342
+ function onGrid(value, path, k, skip) {
2343
2343
  if (typeof value === "number") {
2344
2344
  if (!Number.isFinite(value)) throw new RangeError(`The value has the number ${value} at ${path}. JSON has no form for it.`);
2345
2345
  if (k === void 0) return value;
@@ -2348,23 +2348,95 @@ function onGrid(value, path, k) {
2348
2348
  return r === 0 ? 0 : r;
2349
2349
  }
2350
2350
  if (value === null || typeof value !== "object") return value;
2351
- if (Array.isArray(value)) return value.map((v, i) => onGrid(v, `${path}[${i}]`, k));
2351
+ if (Array.isArray(value)) return value.map((v, i) => onGrid(v, `${path}[${i}]`, k, skip));
2352
2352
  const o = value;
2353
2353
  const out = {};
2354
- for (const key of Object.keys(o)) out[key] = onGrid(o[key], `${path}.${key}`, k);
2354
+ for (const key of Object.keys(o)) if (!skip.has(key)) out[key] = onGrid(o[key], `${path}.${key}`, k, skip);
2355
2355
  return out;
2356
2356
  }
2357
2357
  /**
2358
2358
  * This function gives the hash of an output: the first 16 hex characters of the SHA-256 of its canonical form.
2359
2359
  * Before the canonical form, each number goes to the nearest point of the grid, and `-0` becomes `0`.
2360
2360
  * With the default grid, the rounding is `round3` of `packing`: `Math.round(x * 1000) / 1000`.
2361
- * The function throws a `RangeError` for `NaN` and for an infinite number.
2361
+ * The function throws a `RangeError` for `NaN` and for an infinite number. The fields of `options.skip` are out of the form.
2362
2362
  *
2363
2363
  * The grid can split two outputs. Two numbers near a rounding boundary can go to two different points.
2364
2364
  * The grid can also merge two outputs whose numbers go to the same points. This merge is intentional: it removes the noise of floating-point numbers.
2365
2365
  */
2366
2366
  function outputHash(value, options = {}) {
2367
- return sha256Hex(canonicalJson(onGrid(value, "$", gridFactor(options)))).slice(0, 16);
2367
+ return sha256Hex(canonicalJson(onGrid(value, "$", gridFactor(options), new Set(options.skip ?? [])))).slice(0, 16);
2368
+ }
2369
+ /** This function throws a `RangeError` when a list of the output has an id two times. A packer with this output has a bug. */
2370
+ function uniqueIds(list, ids) {
2371
+ const seen = /* @__PURE__ */ new Set();
2372
+ for (const id of ids) {
2373
+ if (seen.has(id)) throw new RangeError(`The list ${list} of the output has the id "${id}" two times.`);
2374
+ seen.add(id);
2375
+ }
2376
+ }
2377
+ /** The order of two ids by their UTF-16 code units. It does not change with the locale. */
2378
+ function byId(a, b) {
2379
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
2380
+ }
2381
+ /**
2382
+ * This function gives the normal form of the output of a packer, for a fingerprint.
2383
+ * The form has the placements, the overflow, the size and the moved obstacles. It does not have the trace.
2384
+ * The placements, the moved obstacles and the overflow are in the order of their ids. A placement without `turn` gets `turn: 0`.
2385
+ * Thus two packers with the same result in a different order have the same form.
2386
+ * The function throws a `RangeError` when `placements`, `overflow` or `moved` has an id two times.
2387
+ */
2388
+ function packOutputForm(output) {
2389
+ uniqueIds("placements", output.placements.map((p) => p.id));
2390
+ uniqueIds("overflow", output.overflow);
2391
+ uniqueIds("moved", output.moved.map((m) => m.id));
2392
+ return {
2393
+ placements: output.placements.map((p) => ({
2394
+ id: p.id,
2395
+ x: p.x,
2396
+ y: p.y,
2397
+ turn: p.turn ?? 0
2398
+ })).sort(byId),
2399
+ overflow: [...output.overflow].sort(),
2400
+ size: {
2401
+ w: output.size.w,
2402
+ h: output.size.h
2403
+ },
2404
+ moved: output.moved.map((m) => ({
2405
+ id: m.id,
2406
+ x: m.x,
2407
+ y: m.y
2408
+ })).sort(byId)
2409
+ };
2410
+ }
2411
+ /** The hash of a probe that the strategy refused or does not support. It has no reason text, so a new text of a refusal does not change a fingerprint. */
2412
+ const REFUSED_PROBE = "refused";
2413
+ /**
2414
+ * This function gives the hash of one probe of a strategy. It calls `run` and gives `outputHash` of its result, with exact numbers by default.
2415
+ * When `run` throws an error that `refused` accepts, the function gives `REFUSED_PROBE`. It throws each other error again.
2416
+ * The option `grid` of `options` puts the numbers on a grid. Its default here is `0`, so a change in a number changes the hash.
2417
+ */
2418
+ function probeHash(run, refused, options = {}) {
2419
+ let value;
2420
+ try {
2421
+ value = run();
2422
+ } catch (error) {
2423
+ if (refused(error)) return REFUSED_PROBE;
2424
+ throw error;
2425
+ }
2426
+ return outputHash(value, {
2427
+ ...options,
2428
+ grid: options.grid ?? 0
2429
+ });
2430
+ }
2431
+ /**
2432
+ * This function gives the fingerprint of the outputs of one strategy: one hash of the hashes of its probes.
2433
+ * The key of `hashes` is the id of a probe, and its value is the hash of the probe, from `probeHash`.
2434
+ * The order of the keys does not change the fingerprint. A new probe, a probe less or a changed hash changes it.
2435
+ * The function throws a `RangeError` when there is no probe.
2436
+ */
2437
+ function fingerprintOf(hashes) {
2438
+ if (Object.keys(hashes).length === 0) throw new RangeError("A fingerprint needs one probe or more.");
2439
+ return sha256Hex(canonicalJson(hashes)).slice(0, 16);
2368
2440
  }
2369
2441
  /**
2370
2442
  * This function gives the hash of a document. It uses the rule of `outputHash`, but the form does not include the field `hash` of the document.
@@ -6173,6 +6245,6 @@ const RECT_SCATTERED = /* @__PURE__ */ Object.freeze({
6173
6245
  };
6174
6246
  }
6175
6247
  });
6176
- export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CIRCLE_SCATTERED, 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, EPS_STEPS, 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, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, crossingPoint, 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, segmentThroughShape, 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 };
6248
+ export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CIRCLE_SCATTERED, 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, EPS_STEPS, 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, REFUSED_PROBE, 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, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, crossingPoint, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, dimensionAt, dimensionSupports, dimensionUnit, documentHash, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fingerprintOf, fnv1a32, grow, hardRuleOf, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, levelsOf, listOptions, marginSides, minEffectOf, mulberry32, nearestGaps, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, overlapOf, ownerDimension, packHard, packLinks, packOutputForm, paramActive, paramLevels, paramProblem, paramValue, parseLayoutRecord, parseStrategyCatalog, perChange, pickMoves, placedCircle, placedRect, pointSegmentDistance, portPoint, portfolio, probeHash, procrustesOf, productSpace, randomInt, rectInRegion, regionArea, regionHitsRect, resolveDimensions, ruleLevel, segmentThroughShape, 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 };
6177
6249
 
6178
6250
  //# sourceMappingURL=index.js.map