IF Commons GitHub

logical/order

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-archon-logical FR-001, 0003-archon-logical FR-002, 0003-archon-logical FR-003

The order of one subject: the requirements that apply to it, taken from layers (a baseline, a fleet and a host, the higher replacing the lower), in the order they can be carried out. It is made from values and returns a value, and it refuses what cannot be carried out: a requirement twice in a layer, a dependency that is not there and a cycle.

import { buildOrder } from "./order.ts";
// buildOrder({ subject, assurance: "solo", layers: [{ layer: "baseline", requirements }] })

Source: commons/archon/src/logical/order.ts

4 of 9 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Layertype
type Layer = "baseline" | "fleet" | "host";

The layers of precedence, from the lowest to the highest.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

LAYERSconstno test imports it
const LAYERS: readonly Layer[]

Every layer, from the lowest to the highest.

LayerOfRequirementstypeno test imports it
type LayerOfRequirements = { readonly layer: Layer; readonly requirements: readonly Requirement[] };

The requirements of one layer.

Subjecttype
type Subject = { readonly name: SubjectName; readonly class: SubjectClass };

What an order is for.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

Replacedtypeno test imports it
type Replaced = { readonly id: RequirementId; readonly was: Layer; readonly by: Layer };

A requirement that a higher layer replaced.

Ordertype
type Order = {
  readonly subject: Subject;
  readonly assurance: ProfileName;
  /** The requirements that apply, each after the ones it depends on. */
  readonly requirements: readonly Requirement[];
  readonly replaced: readonly Replaced[];
};

The order of a subject.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

OrderProblemtypeno test imports it
type OrderProblem =
  | { readonly kind: "duplicate"; readonly id: RequirementId; readonly layer: Layer }
  | { readonly kind: "missing-dependency"; readonly id: RequirementId; readonly dependsOn: RequirementId }
  | { readonly kind: "cycle"; readonly ids: readonly RequirementId[] };

Why an order could not be made.

OrderInputtypeno test imports it
type OrderInput = {
  readonly subject: Subject;
  readonly assurance: ProfileName;
  readonly layers: readonly LayerOfRequirements[];
  readonly catalogue?: readonly KindSpec[];
};

What buildOrder takes.

buildOrderfunction
function buildOrder(input: OrderInput): Result<Order, readonly OrderProblem[]>

The order of a subject, or every reason it cannot be made.

Imported by 12 tests of the run (12 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.