@mark1russell7/guidebook-plans 0.1.0 → 0.1.1
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 +18 -0
- package/build/index.d.ts +32 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +47 -1
- package/build/index.js.map +1 -1
- package/package.json +2 -2
- package/src/coverage.ts +64 -0
- package/src/index.ts +3 -1
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ Many cases stop the same service. So most steps belong to a cut, and each case t
|
|
|
43
43
|
| `stepsFor(library, on, phases)` | The steps of the keys in the phases, by key, then by phase, then by order. A step comes one time. |
|
|
44
44
|
| `planMatrix(library, gaps, on, phases)` | One row for each key, with one cell for each phase: its steps, or its marked gap |
|
|
45
45
|
| `checkSteps(steps, sources, options)` | The step gate |
|
|
46
|
+
| `checkCoverage(steps, options)` | The coverage gate: each key has steps in each phase |
|
|
47
|
+
| `coverageOf(steps, on, phases)` | The phases with steps and the phases with no step, for each key |
|
|
46
48
|
|
|
47
49
|
```ts
|
|
48
50
|
import { PHASES, checkSteps, phaseOf, stepsFor } from "@mark1russell7/guidebook-plans";
|
|
@@ -68,6 +70,22 @@ const result = checkSteps(library, sources, { phases: PHASES, on: keys, gaps });
|
|
|
68
70
|
| `unmarked-gap` | With `on`: a cell has no step and no gap marks it. |
|
|
69
71
|
| `gap-with-steps`, `duplicate-gap`, `empty-reason` | A gap marks a cell with steps, two gaps mark one cell, or a gap gives no reason. |
|
|
70
72
|
|
|
73
|
+
## The coverage gate
|
|
74
|
+
|
|
75
|
+
The step gate passes a cell with a marked gap. The coverage gate does not. It examines if each key of `on` has steps in each phase of `phases`. `HORIZONS` is the set of the phases from 5 minutes to 5 years: `P0` to `P5`.
|
|
76
|
+
|
|
77
|
+
| Code | When |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| `no-step` | A cell has no step, and no gap marks it. |
|
|
80
|
+
| `marked-gap` | A cell has no step, and a gap marks it. The message gives the reason of the gap. |
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { HORIZONS, checkCoverage } from "@mark1russell7/guidebook-plans";
|
|
84
|
+
|
|
85
|
+
const coverage = checkCoverage(library, { on: keys, phases: HORIZONS, gaps });
|
|
86
|
+
// A key with no step gives one finding for each horizon. It does not pass.
|
|
87
|
+
```
|
|
88
|
+
|
|
71
89
|
## Limits
|
|
72
90
|
|
|
73
91
|
- The gate does not evaluate `when`. The planner of an app evaluates it over the live state.
|
package/build/index.d.ts
CHANGED
|
@@ -103,5 +103,36 @@ export declare function unitsOf<P extends string>(steps: readonly Step<P>[]): re
|
|
|
103
103
|
* With `on`, it also finds each cell of the matrix that has no step and no marked gap.
|
|
104
104
|
*/
|
|
105
105
|
export declare function checkSteps<P extends string>(steps: readonly Step<P>[], sources: readonly Source[], options: StepGateOptions<P>): GateResult<StepFinding>;
|
|
106
|
-
|
|
106
|
+
/** The horizons of a plan: the phases from the first 5 minutes to 5 years. The coverage gate examines them by default. */
|
|
107
|
+
export declare const HORIZONS: readonly ["P0", "P1", "P2", "P3", "P4", "P5"];
|
|
108
|
+
/** The codes of the findings of the coverage gate. */
|
|
109
|
+
export declare const COVERAGE_FINDING_CODES: readonly ["no-step", "marked-gap"];
|
|
110
|
+
/** A code of a finding of the coverage gate. */
|
|
111
|
+
type CoverageFindingCode = (typeof COVERAGE_FINDING_CODES)[number];
|
|
112
|
+
/** A finding of the coverage gate. Its `id` is `<key>/<phase>`. */
|
|
113
|
+
type CoverageFinding = Finding<CoverageFindingCode, "cell">;
|
|
114
|
+
/** The options of the coverage gate. */
|
|
115
|
+
interface CoverageOptions<P extends string> {
|
|
116
|
+
/** The keys of the catalog. Each key needs steps in each phase. */
|
|
117
|
+
readonly on: readonly string[];
|
|
118
|
+
/** The phases that each key needs. */
|
|
119
|
+
readonly phases: readonly P[];
|
|
120
|
+
/** The marked gaps of the library. The gate shows the reason of a gap, but the gap does not pass. */
|
|
121
|
+
readonly gaps?: readonly Gap<P>[];
|
|
122
|
+
}
|
|
123
|
+
/** The coverage of one key: the phases with steps and the phases with no step. */
|
|
124
|
+
interface KeyCoverage<P extends string> {
|
|
125
|
+
readonly on: string;
|
|
126
|
+
readonly covered: readonly P[];
|
|
127
|
+
readonly missing: readonly P[];
|
|
128
|
+
}
|
|
129
|
+
/** This function gives the coverage of each key of `on` over `phases`, in the sequence of `on`. */
|
|
130
|
+
export declare function coverageOf<P extends string>(steps: readonly Step<P>[], on: readonly string[], phases: readonly P[]): readonly KeyCoverage<P>[];
|
|
131
|
+
/**
|
|
132
|
+
* This function applies the coverage gate. Each key of `on` needs one or more steps in each phase of `phases`.
|
|
133
|
+
* A cell with no step is an error, also when a gap marks it: the finding `marked-gap` gives the reason of the gap.
|
|
134
|
+
* Thus a key with no step shows each of its gaps, and it does not pass.
|
|
135
|
+
*/
|
|
136
|
+
export declare function checkCoverage<P extends string>(steps: readonly Step<P>[], options: CoverageOptions<P>): GateResult<CoverageFinding>;
|
|
137
|
+
export type { Cell, CoverageFinding, CoverageFindingCode, CoverageOptions, Gap, KeyCoverage, Ladder, Phase, Step, StepFinding, StepFindingCode, StepGateOptions };
|
|
107
138
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/ladder.ts","../src/steps.ts"],"mappings":";;qBAWa;;UAGI,OAAO;;WAEb,OAAO;;WAEP,QAAQ;;WAER;aAA2B,OAAO;aAAY;;WAC9C,QAAQ,SAAS,OAAO;;;qBAItB;;KAGD,gBAAgB;;qBAGf;;qBAGA,cAAc,SAAS,OAAO;;qBAY9B,QAAQ,OAAO;;wBAQZ,SAAS,kBAAkB,QAAQ,OAAO,cAAc;;;;;;wBASxD,QAAQ,kBAAkB,QAAQ,OAAO,IAAI,iBAAiB,mBAAiB;;wBAU/E,QAAQ,iBAAiB,mBAAiB;;;;;UC/DzC,KAAK,mBAAmB;WAC9B;;WA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O;WACP,gBAAgB,KAAK;WACrB,MAAM,IAAI;;;;;;wBASL,SAAS,kBAAkB,kBAAkB,KAAK,MAAM,uBAAuB,iBAAiB,eAAe,KAAK;;wBAgBpH,WAAW,kBACzB,kBAAkB,KAAK,MACvB,eAAe,IAAI,MACnB,uBACA,iBAAiB,yBACG,KAAK;;qBAWd;;KAgBD,0BAA0B;;KAG1B,cAAc,QAAQ;;UAGjB,gBAAgB,0BAA0B;;WAEhD,iBAAiB;;WAEjB;;WAEA,gBAAgB,IAAI;;;wBAIf,QAAQ,kBAAkB,gBAAgB,KAAK,gBAAgB;;;;;;wBAS/D,WAAW,kBAAkB,gBAAgB,KAAK,MAAM,kBAAkB,UAAU,SAAS,gBAAgB,KAAK,WAAW;;qBCxHhI;;qBAGA;;KAGD,8BAA8B;;KAG9B,kBAAkB,QAAQ;;UAGrB,gBAAgB;;WAEtB;;WAEA,iBAAiB;;WAEjB,gBAAgB,IAAI;;;UAId,YAAY;WAClB;WACA,kBAAkB;WAClB,kBAAkB;;;wBAIb,WAAW,kBAAkB,gBAAgB,KAAK,MAAM,uBAAuB,iBAAiB,eAAe,YAAY;;;;;;wBAa3H,cAAc,kBAAkB,gBAAgB,KAAK,MAAM,SAAS,gBAAgB,KAAK,WAAW"}
|
package/build/index.js
CHANGED
|
@@ -236,6 +236,52 @@ function checkGaps(steps, options) {
|
|
|
236
236
|
}
|
|
237
237
|
return out;
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
// src/coverage.ts
|
|
240
|
+
/** The horizons of a plan: the phases from the first 5 minutes to 5 years. The coverage gate examines them by default. */
|
|
241
|
+
const HORIZONS = [
|
|
242
|
+
"P0",
|
|
243
|
+
"P1",
|
|
244
|
+
"P2",
|
|
245
|
+
"P3",
|
|
246
|
+
"P4",
|
|
247
|
+
"P5"
|
|
248
|
+
];
|
|
249
|
+
/** The codes of the findings of the coverage gate. */
|
|
250
|
+
const COVERAGE_FINDING_CODES = ["no-step", "marked-gap"];
|
|
251
|
+
/** This function gives the coverage of each key of `on` over `phases`, in the sequence of `on`. */
|
|
252
|
+
function coverageOf(steps, on, phases) {
|
|
253
|
+
return planMatrix(steps, [], on, phases).map((row, index) => ({
|
|
254
|
+
on: on[index] ?? "",
|
|
255
|
+
covered: row.filter((cell) => cell.steps.length > 0).map((cell) => cell.phase),
|
|
256
|
+
missing: row.filter((cell) => cell.steps.length === 0).map((cell) => cell.phase)
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* This function applies the coverage gate. Each key of `on` needs one or more steps in each phase of `phases`.
|
|
261
|
+
* A cell with no step is an error, also when a gap marks it: the finding `marked-gap` gives the reason of the gap.
|
|
262
|
+
* Thus a key with no step shows each of its gaps, and it does not pass.
|
|
263
|
+
*/
|
|
264
|
+
function checkCoverage(steps, options) {
|
|
265
|
+
const out = [];
|
|
266
|
+
for (const row of planMatrix(steps, options.gaps ?? [], options.on, options.phases)) for (const cell of row) {
|
|
267
|
+
if (cell.steps.length > 0) continue;
|
|
268
|
+
const id = `${cell.on}/${cell.phase}`;
|
|
269
|
+
out.push(cell.gap === void 0 ? {
|
|
270
|
+
level: "error",
|
|
271
|
+
code: "no-step",
|
|
272
|
+
record: "cell",
|
|
273
|
+
id,
|
|
274
|
+
message: `"${cell.on}" has no step in phase "${cell.phase}".`
|
|
275
|
+
} : {
|
|
276
|
+
level: "error",
|
|
277
|
+
code: "marked-gap",
|
|
278
|
+
record: "cell",
|
|
279
|
+
id,
|
|
280
|
+
message: `"${cell.on}" has no step in phase "${cell.phase}". The gap gives the reason: ${cell.gap.why}`
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
return resultOf(out);
|
|
284
|
+
}
|
|
285
|
+
export { COVERAGE_FINDING_CODES, HORIZONS, LADDER, PHASES, PHASE_BOUNDS, PHASE_TITLES, SECONDS_PER_DAY, STEP_FINDING_CODES, checkCoverage, checkSteps, coverageOf, phaseIn, phaseOf, phasesOf, planMatrix, stepsFor, unitsOf };
|
|
240
286
|
|
|
241
287
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/ladder.ts","../src/steps.ts"],"sourcesContent":["// The time ladder of a plan: the phases before the start of an event, and the phases after it, each with its first second.\n\nconst MINUTE = 60;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\nconst WEEK = 7 * DAY;\n/** A month of the ladder is 30 days, and a year is 365 days. */\nconst MONTH = 30 * DAY;\nconst YEAR = 365 * DAY;\n\n/** This constant is the number of seconds in one day. */\nexport const SECONDS_PER_DAY: number = DAY;\n\n/** A ladder of phases. Each phase has a title that a print or a page shows. */\nexport interface Ladder<P extends string = string> {\n /** The phase before the start of an event, when no warning is live. */\n readonly ready: P;\n /** The phase before the start of an event, when a warning is live. */\n readonly warned: P;\n /** The phases after the start, in their sequence. Each phase starts at its second `from`. The first phase starts at 0. */\n readonly timed: readonly { readonly phase: P; readonly from: number }[];\n readonly titles: Readonly<Record<P, string>>;\n}\n\n/** The phases of the default ladder, in their sequence. */\nexport const PHASES = [\"ready\", \"warned\", \"P0\", \"P1\", \"P2\", \"P3\", \"P4\", \"P5\"] as const;\n\n/** One phase of the default ladder. */\nexport type Phase = (typeof PHASES)[number];\n\n/** The bounds of the phases `P0` to `P5`, in seconds: 0, 5 min, 5 h, 5 d, 5 wk, 5 mo and 5 yr. */\nexport const PHASE_BOUNDS: readonly number[] = [0, 5 * MINUTE, 5 * HOUR, 5 * DAY, 5 * WEEK, 5 * MONTH, 5 * YEAR];\n\n/** The words of each phase of the default ladder. */\nexport const PHASE_TITLES: Readonly<Record<Phase, string>> = {\n ready: \"Before an event\",\n warned: \"When a warning comes\",\n P0: \"In the first 5 minutes\",\n P1: \"From 5 minutes to 5 hours\",\n P2: \"From 5 hours to 5 days\",\n P3: \"From 5 days to 5 weeks\",\n P4: \"From 5 weeks to 5 months\",\n P5: \"From 5 months to 5 years\",\n};\n\n/** The default ladder: each phase after the start is approximately 60 times longer than the phase before it. */\nexport const LADDER: Ladder<Phase> = {\n ready: \"ready\",\n warned: \"warned\",\n timed: ([\"P0\", \"P1\", \"P2\", \"P3\", \"P4\", \"P5\"] as const).map((phase, i) => ({ phase, from: PHASE_BOUNDS[i] ?? 0 })),\n titles: PHASE_TITLES,\n};\n\n/** This function gives the phases of a ladder in their sequence: `ready`, `warned`, then the timed phases. */\nexport function phasesOf<P extends string>(ladder: Ladder<P>): readonly P[] {\n return [ladder.ready, ladder.warned, ...ladder.timed.map((step) => step.phase)];\n}\n\n/**\n * This function gives the phase of a time on a ladder, in seconds from the start of the event.\n * A negative time is before the start: it gives `warned` when a warning is live, else `ready`.\n * A time at a bound is in the later phase. A time after the start of the last phase stays in the last phase.\n */\nexport function phaseIn<P extends string>(ladder: Ladder<P>, seconds: number, warned = false): P {\n if (!Number.isFinite(seconds)) throw new RangeError(`phaseIn: the time ${String(seconds)} is not a finite number.`);\n if (seconds < 0) return warned ? ladder.warned : ladder.ready;\n let phase: P | undefined;\n for (const step of ladder.timed) if (seconds >= step.from) phase = step.phase;\n if (phase === undefined) throw new RangeError(\"phaseIn: the ladder has no timed phase that starts at 0.\");\n return phase;\n}\n\n/** This function gives the phase of a time on the default ladder. 5 minutes gives `P1`. */\nexport function phaseOf(seconds: number, warned = false): Phase {\n return phaseIn(LADDER, seconds, warned);\n}\n","// The steps of a plan, the query of the steps, the matrix of the library, and the step gate.\n\nimport { checkUnits, resultOf } from \"@mark1russell7/guidebook\";\nimport type { CitedUnit, Finding, GateResult, Source, SourceId, UseContext } from \"@mark1russell7/guidebook\";\nimport type { Phase } from \"./ladder.ts\";\n\n/**\n * One action of a plan. A step belongs to a key and to a phase.\n * A key names a case (a kind of event) or a cut (a service that an event stops). A plan of a case is its own steps and the steps of its cuts.\n */\nexport interface Step<P extends string = Phase> {\n readonly id: string;\n /** The key of the step: a case or a cut. */\n readonly on: string;\n readonly phase: P;\n /** The needs that the step protects. */\n readonly needs: readonly string[];\n /** An optional condition: a Vex program over the live state. No `when` means always. */\n readonly when?: string;\n /**\n * The action, as one instruction in Simplified Technical English, in the words of the guidebook.\n * When the step has a `when`, this text names the condition in words, because a print cannot examine `when`.\n */\n readonly do: string;\n /** The parts, the resources and the topics that the step uses. */\n readonly uses?: readonly string[];\n /** The order of the step in its phase, from 1. */\n readonly order: number;\n /** The sources of the step. Each step has one or more. */\n readonly sources: readonly SourceId[];\n}\n\n/** A marked gap: a key and a phase that have no step on purpose, with the reason. */\nexport interface Gap<P extends string = Phase> {\n readonly on: string;\n readonly phase: P;\n /** The reason, for example \"A house fire gives no warning.\" */\n readonly why: string;\n}\n\n/** A cell of the matrix of a library: the steps of one key in one phase, or the marked gap of the cell. */\nexport interface Cell<P extends string = Phase> {\n readonly on: string;\n readonly phase: P;\n readonly steps: readonly Step<P>[];\n readonly gap?: Gap<P>;\n}\n\nconst byOrder = <P extends string>(a: Step<P>, b: Step<P>): number => a.order - b.order || a.id.localeCompare(b.id);\n\n/**\n * This function gives the steps whose `on` is in `on` and whose phase is in `phases`.\n * The sequence is by `on`, then by `phases`, then by `order`. A step that matches two entries of `on` comes one time.\n */\nexport function stepsFor<P extends string>(library: readonly Step<P>[], on: readonly string[], phases: readonly P[]): readonly Step<P>[] {\n const out: Step<P>[] = [];\n const seen = new Set<string>();\n for (const key of on) {\n for (const phase of phases) {\n const hits = library.filter((step) => step.on === key && step.phase === phase && !seen.has(step.id)).sort(byOrder);\n for (const step of hits) {\n seen.add(step.id);\n out.push(step);\n }\n }\n }\n return out;\n}\n\n/** This function gives the matrix of a library: one row for each key of `on`, with one cell for each phase of `phases`. */\nexport function planMatrix<P extends string>(\n library: readonly Step<P>[],\n gaps: readonly Gap<P>[],\n on: readonly string[],\n phases: readonly P[],\n): readonly (readonly Cell<P>[])[] {\n return on.map((key) =>\n phases.map((phase) => {\n const steps = library.filter((step) => step.on === key && step.phase === phase).sort(byOrder);\n const gap = gaps.find((item) => item.on === key && item.phase === phase);\n return gap === undefined ? { on: key, phase, steps } : { on: key, phase, steps, gap };\n }),\n );\n}\n\n/** The codes of the findings of the step gate. The codes of the source gate also apply to the sources of the steps. */\nexport const STEP_FINDING_CODES = [\n \"duplicate-id\",\n \"empty-text\",\n \"no-source\",\n \"missing-source\",\n \"use-refused\",\n \"unknown-phase\",\n \"bad-order\",\n \"duplicate-order\",\n \"unmarked-gap\",\n \"gap-with-steps\",\n \"duplicate-gap\",\n \"empty-reason\",\n] as const;\n\n/** A code of a finding of the step gate. */\nexport type StepFindingCode = (typeof STEP_FINDING_CODES)[number];\n\n/** A finding of the step gate. */\nexport type StepFinding = Finding<StepFindingCode, \"step\" | \"gap\" | \"cell\">;\n\n/** The options of the step gate. */\nexport interface StepGateOptions<P extends string> extends UseContext {\n /** The phases that a step can have. */\n readonly phases: readonly P[];\n /** The keys of the matrix. With them, the gate finds each cell that has no step and no marked gap. */\n readonly on?: readonly string[];\n /** The marked gaps of the library. */\n readonly gaps?: readonly Gap<P>[];\n}\n\n/** This function gives one summary unit for each source of each step, so the source gate examines the steps. */\nexport function unitsOf<P extends string>(steps: readonly Step<P>[]): readonly CitedUnit[] {\n return steps.flatMap((step) => step.sources.map((source) => ({ id: `${step.id}@${source}`, use: \"summary\" as const, text: step.do, source })));\n}\n\n/**\n * This function applies the step gate. It examines the ids, the text, the sources, the phases and the order of each step.\n * It examines the sources with the source gate: the text of a step is a summary of each of its sources.\n * With `on`, it also finds each cell of the matrix that has no step and no marked gap.\n */\nexport function checkSteps<P extends string>(steps: readonly Step<P>[], sources: readonly Source[], options: StepGateOptions<P>): GateResult<StepFinding> {\n const out: StepFinding[] = [];\n const error = (code: StepFindingCode, record: StepFinding[\"record\"], id: string, message: string): void => {\n out.push({ level: \"error\", code, record, id, message });\n };\n const phases = new Set<string>(options.phases);\n const ids = new Set<string>();\n const orders = new Map<string, string>();\n for (const step of steps) {\n if (ids.has(step.id)) error(\"duplicate-id\", \"step\", step.id, `Two steps have the id \"${step.id}\".`);\n ids.add(step.id);\n if (step.do.trim() === \"\") error(\"empty-text\", \"step\", step.id, `The step \"${step.id}\" has no text.`);\n if (step.sources.length === 0) error(\"no-source\", \"step\", step.id, `The step \"${step.id}\" cites no source.`);\n if (!phases.has(step.phase)) error(\"unknown-phase\", \"step\", step.id, `The step \"${step.id}\" has the unknown phase \"${step.phase}\".`);\n if (!Number.isInteger(step.order) || step.order < 1) error(\"bad-order\", \"step\", step.id, `The step \"${step.id}\" has the order ${String(step.order)}. It needs an integer from 1.`);\n const cell = `${step.on}\\u0000${step.phase}\\u0000${String(step.order)}`;\n const other = orders.get(cell);\n if (other !== undefined) error(\"duplicate-order\", \"step\", step.id, `The steps \"${other}\" and \"${step.id}\" have the same order in \"${step.on}\", phase \"${step.phase}\".`);\n else orders.set(cell, step.id);\n }\n for (const finding of checkUnits(unitsOf(steps), sources, options)) {\n if (finding.code !== \"missing-source\" && finding.code !== \"use-refused\") continue;\n const id = finding.id.slice(0, finding.id.lastIndexOf(\"@\"));\n out.push({ level: finding.level, code: finding.code, record: \"step\", id, message: finding.message.replace(`unit \"${finding.id}\"`, `step \"${id}\"`) });\n }\n out.push(...checkGaps(steps, options));\n return resultOf(out);\n}\n\nfunction checkGaps<P extends string>(steps: readonly Step<P>[], options: StepGateOptions<P>): StepFinding[] {\n const out: StepFinding[] = [];\n const gaps = options.gaps ?? [];\n const seen = new Set<string>();\n for (const gap of gaps) {\n const id = `${gap.on}/${gap.phase}`;\n if (seen.has(id)) out.push({ level: \"error\", code: \"duplicate-gap\", record: \"gap\", id, message: `Two gaps mark \"${gap.on}\" in phase \"${gap.phase}\".` });\n seen.add(id);\n if (gap.why.trim() === \"\") out.push({ level: \"error\", code: \"empty-reason\", record: \"gap\", id, message: `The gap of \"${gap.on}\" in phase \"${gap.phase}\" gives no reason.` });\n const count = steps.filter((step) => step.on === gap.on && step.phase === gap.phase).length;\n if (count > 0) out.push({ level: \"error\", code: \"gap-with-steps\", record: \"gap\", id, message: `A gap marks \"${gap.on}\" in phase \"${gap.phase}\", but the cell has ${String(count)} steps.` });\n if (!options.phases.includes(gap.phase)) out.push({ level: \"error\", code: \"unknown-phase\", record: \"gap\", id, message: `The gap of \"${gap.on}\" has the unknown phase \"${gap.phase}\".` });\n }\n if (options.on === undefined) return out;\n for (const row of planMatrix(steps, gaps, options.on, options.phases)) {\n for (const cell of row) {\n const id = `${cell.on}/${cell.phase}`;\n if (cell.steps.length === 0 && cell.gap === undefined) {\n out.push({ level: \"error\", code: \"unmarked-gap\", record: \"cell\", id, message: `\"${cell.on}\" has no step in phase \"${cell.phase}\", and no gap marks the cell.` });\n }\n }\n }\n return out;\n}\n"],"mappings":";;AAGA,MAAM,OAAO;AACb,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;;AAEjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;;AAGnB,MAAa,kBAA0B;;AAcvC,MAAa,SAAS;CAAC;CAAS;CAAU;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;;AAM5E,MAAa,eAAkC;CAAC;CAAG;CAAY,IAAI;CAAM,IAAI;CAAK,IAAI;CAAM,IAAI;CAAO,IAAI;AAAI;;AAG/G,MAAa,eAAgD;CAC3D,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;AAGA,MAAa,SAAwB;CACnC,OAAO;CACP,QAAQ;CACR,OAAQ;EAAC;EAAM;EAAM;EAAM;EAAM;EAAM;CAAI,CAAC,CAAW,KAAK,OAAO,OAAO;EAAE;EAAO,MAAM,aAAa,MAAM;CAAE,EAAE;CAChH,QAAQ;AACV;;AAGA,SAAgB,SAA2B,QAAiC;CAC1E,OAAO;EAAC,OAAO;EAAO,OAAO;EAAQ,GAAG,OAAO,MAAM,KAAK,SAAS,KAAK,KAAK;CAAC;AAChF;;;;;;AAOA,SAAgB,QAA0B,QAAmB,SAAiB,SAAS,OAAU;CAC/F,IAAI,CAAC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AgB,QAAQ;GAAO;GAAI,SAAS,eAAe,IAAI,GAAG,cAAc,IAAI,MAAM;EAAoB,CAAC;EAC3K,MAAM,QAAQ,MAAM,QAAQ,SAAS,KAAK,OAAO,IAAI,MAAM,KAAK,UAAU,IAAI,KAAK,CAAC,CAAC;EACrF,IAAI,QAAQ,GAAG,IAAI,KAAK;GAAE,OAAO;GAAS,MAAM;GAAkB,QAAQ;GAAO;GAAI,SAAS,gBAAgB,IAAI,GAAG,cAAc,IAAI,MAAM,sBAAsB,OAAO,KAAK,EAAE;EAAS,CAAC;EAC3L,IAAI,CAAC,QAAQ,OAAO,SAAS,IAAI,KAAK,GAAG,IAAI,KAAK;GAAE,OAAO;GAAS,MAAM;GAAiB,QAAQ;GAAO;GAAI,SAAS,eAAe,IAAI,GAAG,2BAA2B,IAAI,MAAM;EAAI,CAAC;CACzL;CACA,IAAI,QAAQ,OAAO,KAAA,GAAW,OAAO;CACrC,KAAK,MAAM,OAAO,WAAW,OAAO,MAAM,QAAQ,IAAI,QAAQ,MAAM,GAClE,KAAK,MAAM,QAAQ,KAAK;EACtB,MAAM,KAAK,GAAG,KAAK,GAAG,GAAG,KAAK;EAC9B,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,QAAQ,KAAA,GAC1C,IAAI,KAAK;GAAE,OAAO;GAAS,MAAM;GAAgB,QAAQ;GAAQ;GAAI,SAAS,IAAI,KAAK,GAAG,0BAA0B,KAAK,MAAM;EAA+B,CAAC;CAEnK;CAEF,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/ladder.ts","../src/steps.ts","../src/coverage.ts"],"sourcesContent":["// The time ladder of a plan: the phases before the start of an event, and the phases after it, each with its first second.\n\nconst MINUTE = 60;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\nconst WEEK = 7 * DAY;\n/** A month of the ladder is 30 days, and a year is 365 days. */\nconst MONTH = 30 * DAY;\nconst YEAR = 365 * DAY;\n\n/** This constant is the number of seconds in one day. */\nexport const SECONDS_PER_DAY: number = DAY;\n\n/** A ladder of phases. Each phase has a title that a print or a page shows. */\nexport interface Ladder<P extends string = string> {\n /** The phase before the start of an event, when no warning is live. */\n readonly ready: P;\n /** The phase before the start of an event, when a warning is live. */\n readonly warned: P;\n /** The phases after the start, in their sequence. Each phase starts at its second `from`. The first phase starts at 0. */\n readonly timed: readonly { readonly phase: P; readonly from: number }[];\n readonly titles: Readonly<Record<P, string>>;\n}\n\n/** The phases of the default ladder, in their sequence. */\nexport const PHASES = [\"ready\", \"warned\", \"P0\", \"P1\", \"P2\", \"P3\", \"P4\", \"P5\"] as const;\n\n/** One phase of the default ladder. */\nexport type Phase = (typeof PHASES)[number];\n\n/** The bounds of the phases `P0` to `P5`, in seconds: 0, 5 min, 5 h, 5 d, 5 wk, 5 mo and 5 yr. */\nexport const PHASE_BOUNDS: readonly number[] = [0, 5 * MINUTE, 5 * HOUR, 5 * DAY, 5 * WEEK, 5 * MONTH, 5 * YEAR];\n\n/** The words of each phase of the default ladder. */\nexport const PHASE_TITLES: Readonly<Record<Phase, string>> = {\n ready: \"Before an event\",\n warned: \"When a warning comes\",\n P0: \"In the first 5 minutes\",\n P1: \"From 5 minutes to 5 hours\",\n P2: \"From 5 hours to 5 days\",\n P3: \"From 5 days to 5 weeks\",\n P4: \"From 5 weeks to 5 months\",\n P5: \"From 5 months to 5 years\",\n};\n\n/** The default ladder: each phase after the start is approximately 60 times longer than the phase before it. */\nexport const LADDER: Ladder<Phase> = {\n ready: \"ready\",\n warned: \"warned\",\n timed: ([\"P0\", \"P1\", \"P2\", \"P3\", \"P4\", \"P5\"] as const).map((phase, i) => ({ phase, from: PHASE_BOUNDS[i] ?? 0 })),\n titles: PHASE_TITLES,\n};\n\n/** This function gives the phases of a ladder in their sequence: `ready`, `warned`, then the timed phases. */\nexport function phasesOf<P extends string>(ladder: Ladder<P>): readonly P[] {\n return [ladder.ready, ladder.warned, ...ladder.timed.map((step) => step.phase)];\n}\n\n/**\n * This function gives the phase of a time on a ladder, in seconds from the start of the event.\n * A negative time is before the start: it gives `warned` when a warning is live, else `ready`.\n * A time at a bound is in the later phase. A time after the start of the last phase stays in the last phase.\n */\nexport function phaseIn<P extends string>(ladder: Ladder<P>, seconds: number, warned = false): P {\n if (!Number.isFinite(seconds)) throw new RangeError(`phaseIn: the time ${String(seconds)} is not a finite number.`);\n if (seconds < 0) return warned ? ladder.warned : ladder.ready;\n let phase: P | undefined;\n for (const step of ladder.timed) if (seconds >= step.from) phase = step.phase;\n if (phase === undefined) throw new RangeError(\"phaseIn: the ladder has no timed phase that starts at 0.\");\n return phase;\n}\n\n/** This function gives the phase of a time on the default ladder. 5 minutes gives `P1`. */\nexport function phaseOf(seconds: number, warned = false): Phase {\n return phaseIn(LADDER, seconds, warned);\n}\n","// The steps of a plan, the query of the steps, the matrix of the library, and the step gate.\n\nimport { checkUnits, resultOf } from \"@mark1russell7/guidebook\";\nimport type { CitedUnit, Finding, GateResult, Source, SourceId, UseContext } from \"@mark1russell7/guidebook\";\nimport type { Phase } from \"./ladder.ts\";\n\n/**\n * One action of a plan. A step belongs to a key and to a phase.\n * A key names a case (a kind of event) or a cut (a service that an event stops). A plan of a case is its own steps and the steps of its cuts.\n */\nexport interface Step<P extends string = Phase> {\n readonly id: string;\n /** The key of the step: a case or a cut. */\n readonly on: string;\n readonly phase: P;\n /** The needs that the step protects. */\n readonly needs: readonly string[];\n /** An optional condition: a Vex program over the live state. No `when` means always. */\n readonly when?: string;\n /**\n * The action, as one instruction in Simplified Technical English, in the words of the guidebook.\n * When the step has a `when`, this text names the condition in words, because a print cannot examine `when`.\n */\n readonly do: string;\n /** The parts, the resources and the topics that the step uses. */\n readonly uses?: readonly string[];\n /** The order of the step in its phase, from 1. */\n readonly order: number;\n /** The sources of the step. Each step has one or more. */\n readonly sources: readonly SourceId[];\n}\n\n/** A marked gap: a key and a phase that have no step on purpose, with the reason. */\nexport interface Gap<P extends string = Phase> {\n readonly on: string;\n readonly phase: P;\n /** The reason, for example \"A house fire gives no warning.\" */\n readonly why: string;\n}\n\n/** A cell of the matrix of a library: the steps of one key in one phase, or the marked gap of the cell. */\nexport interface Cell<P extends string = Phase> {\n readonly on: string;\n readonly phase: P;\n readonly steps: readonly Step<P>[];\n readonly gap?: Gap<P>;\n}\n\nconst byOrder = <P extends string>(a: Step<P>, b: Step<P>): number => a.order - b.order || a.id.localeCompare(b.id);\n\n/**\n * This function gives the steps whose `on` is in `on` and whose phase is in `phases`.\n * The sequence is by `on`, then by `phases`, then by `order`. A step that matches two entries of `on` comes one time.\n */\nexport function stepsFor<P extends string>(library: readonly Step<P>[], on: readonly string[], phases: readonly P[]): readonly Step<P>[] {\n const out: Step<P>[] = [];\n const seen = new Set<string>();\n for (const key of on) {\n for (const phase of phases) {\n const hits = library.filter((step) => step.on === key && step.phase === phase && !seen.has(step.id)).sort(byOrder);\n for (const step of hits) {\n seen.add(step.id);\n out.push(step);\n }\n }\n }\n return out;\n}\n\n/** This function gives the matrix of a library: one row for each key of `on`, with one cell for each phase of `phases`. */\nexport function planMatrix<P extends string>(\n library: readonly Step<P>[],\n gaps: readonly Gap<P>[],\n on: readonly string[],\n phases: readonly P[],\n): readonly (readonly Cell<P>[])[] {\n return on.map((key) =>\n phases.map((phase) => {\n const steps = library.filter((step) => step.on === key && step.phase === phase).sort(byOrder);\n const gap = gaps.find((item) => item.on === key && item.phase === phase);\n return gap === undefined ? { on: key, phase, steps } : { on: key, phase, steps, gap };\n }),\n );\n}\n\n/** The codes of the findings of the step gate. The codes of the source gate also apply to the sources of the steps. */\nexport const STEP_FINDING_CODES = [\n \"duplicate-id\",\n \"empty-text\",\n \"no-source\",\n \"missing-source\",\n \"use-refused\",\n \"unknown-phase\",\n \"bad-order\",\n \"duplicate-order\",\n \"unmarked-gap\",\n \"gap-with-steps\",\n \"duplicate-gap\",\n \"empty-reason\",\n] as const;\n\n/** A code of a finding of the step gate. */\nexport type StepFindingCode = (typeof STEP_FINDING_CODES)[number];\n\n/** A finding of the step gate. */\nexport type StepFinding = Finding<StepFindingCode, \"step\" | \"gap\" | \"cell\">;\n\n/** The options of the step gate. */\nexport interface StepGateOptions<P extends string> extends UseContext {\n /** The phases that a step can have. */\n readonly phases: readonly P[];\n /** The keys of the matrix. With them, the gate finds each cell that has no step and no marked gap. */\n readonly on?: readonly string[];\n /** The marked gaps of the library. */\n readonly gaps?: readonly Gap<P>[];\n}\n\n/** This function gives one summary unit for each source of each step, so the source gate examines the steps. */\nexport function unitsOf<P extends string>(steps: readonly Step<P>[]): readonly CitedUnit[] {\n return steps.flatMap((step) => step.sources.map((source) => ({ id: `${step.id}@${source}`, use: \"summary\" as const, text: step.do, source })));\n}\n\n/**\n * This function applies the step gate. It examines the ids, the text, the sources, the phases and the order of each step.\n * It examines the sources with the source gate: the text of a step is a summary of each of its sources.\n * With `on`, it also finds each cell of the matrix that has no step and no marked gap.\n */\nexport function checkSteps<P extends string>(steps: readonly Step<P>[], sources: readonly Source[], options: StepGateOptions<P>): GateResult<StepFinding> {\n const out: StepFinding[] = [];\n const error = (code: StepFindingCode, record: StepFinding[\"record\"], id: string, message: string): void => {\n out.push({ level: \"error\", code, record, id, message });\n };\n const phases = new Set<string>(options.phases);\n const ids = new Set<string>();\n const orders = new Map<string, string>();\n for (const step of steps) {\n if (ids.has(step.id)) error(\"duplicate-id\", \"step\", step.id, `Two steps have the id \"${step.id}\".`);\n ids.add(step.id);\n if (step.do.trim() === \"\") error(\"empty-text\", \"step\", step.id, `The step \"${step.id}\" has no text.`);\n if (step.sources.length === 0) error(\"no-source\", \"step\", step.id, `The step \"${step.id}\" cites no source.`);\n if (!phases.has(step.phase)) error(\"unknown-phase\", \"step\", step.id, `The step \"${step.id}\" has the unknown phase \"${step.phase}\".`);\n if (!Number.isInteger(step.order) || step.order < 1) error(\"bad-order\", \"step\", step.id, `The step \"${step.id}\" has the order ${String(step.order)}. It needs an integer from 1.`);\n const cell = `${step.on}\\u0000${step.phase}\\u0000${String(step.order)}`;\n const other = orders.get(cell);\n if (other !== undefined) error(\"duplicate-order\", \"step\", step.id, `The steps \"${other}\" and \"${step.id}\" have the same order in \"${step.on}\", phase \"${step.phase}\".`);\n else orders.set(cell, step.id);\n }\n for (const finding of checkUnits(unitsOf(steps), sources, options)) {\n if (finding.code !== \"missing-source\" && finding.code !== \"use-refused\") continue;\n const id = finding.id.slice(0, finding.id.lastIndexOf(\"@\"));\n out.push({ level: finding.level, code: finding.code, record: \"step\", id, message: finding.message.replace(`unit \"${finding.id}\"`, `step \"${id}\"`) });\n }\n out.push(...checkGaps(steps, options));\n return resultOf(out);\n}\n\nfunction checkGaps<P extends string>(steps: readonly Step<P>[], options: StepGateOptions<P>): StepFinding[] {\n const out: StepFinding[] = [];\n const gaps = options.gaps ?? [];\n const seen = new Set<string>();\n for (const gap of gaps) {\n const id = `${gap.on}/${gap.phase}`;\n if (seen.has(id)) out.push({ level: \"error\", code: \"duplicate-gap\", record: \"gap\", id, message: `Two gaps mark \"${gap.on}\" in phase \"${gap.phase}\".` });\n seen.add(id);\n if (gap.why.trim() === \"\") out.push({ level: \"error\", code: \"empty-reason\", record: \"gap\", id, message: `The gap of \"${gap.on}\" in phase \"${gap.phase}\" gives no reason.` });\n const count = steps.filter((step) => step.on === gap.on && step.phase === gap.phase).length;\n if (count > 0) out.push({ level: \"error\", code: \"gap-with-steps\", record: \"gap\", id, message: `A gap marks \"${gap.on}\" in phase \"${gap.phase}\", but the cell has ${String(count)} steps.` });\n if (!options.phases.includes(gap.phase)) out.push({ level: \"error\", code: \"unknown-phase\", record: \"gap\", id, message: `The gap of \"${gap.on}\" has the unknown phase \"${gap.phase}\".` });\n }\n if (options.on === undefined) return out;\n for (const row of planMatrix(steps, gaps, options.on, options.phases)) {\n for (const cell of row) {\n const id = `${cell.on}/${cell.phase}`;\n if (cell.steps.length === 0 && cell.gap === undefined) {\n out.push({ level: \"error\", code: \"unmarked-gap\", record: \"cell\", id, message: `\"${cell.on}\" has no step in phase \"${cell.phase}\", and no gap marks the cell.` });\n }\n }\n }\n return out;\n}\n","// The coverage gate: each key of a catalog has steps in each phase of a set. A marked gap does not pass it.\n\nimport { resultOf } from \"@mark1russell7/guidebook\";\nimport type { Finding, GateResult } from \"@mark1russell7/guidebook\";\nimport { planMatrix, type Gap, type Step } from \"./steps.ts\";\n\n/** The horizons of a plan: the phases from the first 5 minutes to 5 years. The coverage gate examines them by default. */\nexport const HORIZONS = [\"P0\", \"P1\", \"P2\", \"P3\", \"P4\", \"P5\"] as const;\n\n/** The codes of the findings of the coverage gate. */\nexport const COVERAGE_FINDING_CODES = [\"no-step\", \"marked-gap\"] as const;\n\n/** A code of a finding of the coverage gate. */\nexport type CoverageFindingCode = (typeof COVERAGE_FINDING_CODES)[number];\n\n/** A finding of the coverage gate. Its `id` is `<key>/<phase>`. */\nexport type CoverageFinding = Finding<CoverageFindingCode, \"cell\">;\n\n/** The options of the coverage gate. */\nexport interface CoverageOptions<P extends string> {\n /** The keys of the catalog. Each key needs steps in each phase. */\n readonly on: readonly string[];\n /** The phases that each key needs. */\n readonly phases: readonly P[];\n /** The marked gaps of the library. The gate shows the reason of a gap, but the gap does not pass. */\n readonly gaps?: readonly Gap<P>[];\n}\n\n/** The coverage of one key: the phases with steps and the phases with no step. */\nexport interface KeyCoverage<P extends string> {\n readonly on: string;\n readonly covered: readonly P[];\n readonly missing: readonly P[];\n}\n\n/** This function gives the coverage of each key of `on` over `phases`, in the sequence of `on`. */\nexport function coverageOf<P extends string>(steps: readonly Step<P>[], on: readonly string[], phases: readonly P[]): readonly KeyCoverage<P>[] {\n return planMatrix(steps, [], on, phases).map((row, index) => ({\n on: on[index] ?? \"\",\n covered: row.filter((cell) => cell.steps.length > 0).map((cell) => cell.phase),\n missing: row.filter((cell) => cell.steps.length === 0).map((cell) => cell.phase),\n }));\n}\n\n/**\n * This function applies the coverage gate. Each key of `on` needs one or more steps in each phase of `phases`.\n * A cell with no step is an error, also when a gap marks it: the finding `marked-gap` gives the reason of the gap.\n * Thus a key with no step shows each of its gaps, and it does not pass.\n */\nexport function checkCoverage<P extends string>(steps: readonly Step<P>[], options: CoverageOptions<P>): GateResult<CoverageFinding> {\n const out: CoverageFinding[] = [];\n for (const row of planMatrix(steps, options.gaps ?? [], options.on, options.phases)) {\n for (const cell of row) {\n if (cell.steps.length > 0) continue;\n const id = `${cell.on}/${cell.phase}`;\n out.push(\n cell.gap === undefined\n ? { level: \"error\", code: \"no-step\", record: \"cell\", id, message: `\"${cell.on}\" has no step in phase \"${cell.phase}\".` }\n : { level: \"error\", code: \"marked-gap\", record: \"cell\", id, message: `\"${cell.on}\" has no step in phase \"${cell.phase}\". The gap gives the reason: ${cell.gap.why}` },\n );\n }\n }\n return resultOf(out);\n}\n"],"mappings":";;AAGA,MAAM,OAAO;AACb,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;;AAEjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;;AAGnB,MAAa,kBAA0B;;AAcvC,MAAa,SAAS;CAAC;CAAS;CAAU;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;;AAM5E,MAAa,eAAkC;CAAC;CAAG;CAAY,IAAI;CAAM,IAAI;CAAK,IAAI;CAAM,IAAI;CAAO,IAAI;AAAI;;AAG/G,MAAa,eAAgD;CAC3D,OAAO;CACP,QAAQ;CACR,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;AAGA,MAAa,SAAwB;CACnC,OAAO;CACP,QAAQ;CACR,OAAQ;EAAC;EAAM;EAAM;EAAM;EAAM;EAAM;CAAI,CAAC,CAAW,KAAK,OAAO,OAAO;EAAE;EAAO,MAAM,aAAa,MAAM;CAAE,EAAE;CAChH,QAAQ;AACV;;AAGA,SAAgB,SAA2B,QAAiC;CAC1E,OAAO;EAAC,OAAO;EAAO,OAAO;EAAQ,GAAG,OAAO,MAAM,KAAK,SAAS,KAAK,KAAK;CAAC;AAChF;;;;;;AAOA,SAAgB,QAA0B,QA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B,SAAS,IAAI,QAAQ,SAAS,KAAK,MAAM,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,KAAK,KAAK;EAC7E,SAAS,IAAI,QAAQ,SAAS,KAAK,MAAM,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,KAAK,KAAK;CACjF,EAAE;AACJ;;;;;;AAOA,SAAgB,cAAgC,OAA2B,SAA0D;CACnI,MAAM,MAAyB,CAAC;CAChC,KAAK,MAAM,OAAO,WAAW,OAAO,QAAQ,QAAQ,CAAC,GAAG,QAAQ,IAAI,QAAQ,MAAM,GAChF,KAAK,MAAM,QAAQ,KAAK;EACtB,IAAI,KAAK,MAAM,SAAS,GAAG;EAC3B,MAAM,KAAK,GAAG,KAAK,GAAG,GAAG,KAAK;EAC9B,IAAI,KACF,KAAK,QAAQ,KAAA,IACT;GAAE,OAAO;GAAS,MAAM;GAAW,QAAQ;GAAQ;GAAI,SAAS,IAAI,KAAK,GAAG,0BAA0B,KAAK,MAAM;EAAI,IACrH;GAAE,OAAO;GAAS,MAAM;GAAc,QAAQ;GAAQ;GAAI,SAAS,IAAI,KAAK,GAAG,0BAA0B,KAAK,MAAM,+BAA+B,KAAK,IAAI;EAAM,CACxK;CACF;CAEF,OAAO,SAAS,GAAG;AACrB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/guidebook-plans",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "The plans add-on of the guidebook: a time ladder of phases, steps keyed by a case or a cut and a phase, the steps query, the matrix of a library with its marked gaps, and the step gate.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"guidebook",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"tsdown": "^0.23.7"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@mark1russell7/guidebook": "0.1.
|
|
56
|
+
"@mark1russell7/guidebook": "0.1.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsdown",
|
package/src/coverage.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// The coverage gate: each key of a catalog has steps in each phase of a set. A marked gap does not pass it.
|
|
2
|
+
|
|
3
|
+
import { resultOf } from "@mark1russell7/guidebook";
|
|
4
|
+
import type { Finding, GateResult } from "@mark1russell7/guidebook";
|
|
5
|
+
import { planMatrix, type Gap, type Step } from "./steps.ts";
|
|
6
|
+
|
|
7
|
+
/** The horizons of a plan: the phases from the first 5 minutes to 5 years. The coverage gate examines them by default. */
|
|
8
|
+
export const HORIZONS = ["P0", "P1", "P2", "P3", "P4", "P5"] as const;
|
|
9
|
+
|
|
10
|
+
/** The codes of the findings of the coverage gate. */
|
|
11
|
+
export const COVERAGE_FINDING_CODES = ["no-step", "marked-gap"] as const;
|
|
12
|
+
|
|
13
|
+
/** A code of a finding of the coverage gate. */
|
|
14
|
+
export type CoverageFindingCode = (typeof COVERAGE_FINDING_CODES)[number];
|
|
15
|
+
|
|
16
|
+
/** A finding of the coverage gate. Its `id` is `<key>/<phase>`. */
|
|
17
|
+
export type CoverageFinding = Finding<CoverageFindingCode, "cell">;
|
|
18
|
+
|
|
19
|
+
/** The options of the coverage gate. */
|
|
20
|
+
export interface CoverageOptions<P extends string> {
|
|
21
|
+
/** The keys of the catalog. Each key needs steps in each phase. */
|
|
22
|
+
readonly on: readonly string[];
|
|
23
|
+
/** The phases that each key needs. */
|
|
24
|
+
readonly phases: readonly P[];
|
|
25
|
+
/** The marked gaps of the library. The gate shows the reason of a gap, but the gap does not pass. */
|
|
26
|
+
readonly gaps?: readonly Gap<P>[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The coverage of one key: the phases with steps and the phases with no step. */
|
|
30
|
+
export interface KeyCoverage<P extends string> {
|
|
31
|
+
readonly on: string;
|
|
32
|
+
readonly covered: readonly P[];
|
|
33
|
+
readonly missing: readonly P[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** This function gives the coverage of each key of `on` over `phases`, in the sequence of `on`. */
|
|
37
|
+
export function coverageOf<P extends string>(steps: readonly Step<P>[], on: readonly string[], phases: readonly P[]): readonly KeyCoverage<P>[] {
|
|
38
|
+
return planMatrix(steps, [], on, phases).map((row, index) => ({
|
|
39
|
+
on: on[index] ?? "",
|
|
40
|
+
covered: row.filter((cell) => cell.steps.length > 0).map((cell) => cell.phase),
|
|
41
|
+
missing: row.filter((cell) => cell.steps.length === 0).map((cell) => cell.phase),
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* This function applies the coverage gate. Each key of `on` needs one or more steps in each phase of `phases`.
|
|
47
|
+
* A cell with no step is an error, also when a gap marks it: the finding `marked-gap` gives the reason of the gap.
|
|
48
|
+
* Thus a key with no step shows each of its gaps, and it does not pass.
|
|
49
|
+
*/
|
|
50
|
+
export function checkCoverage<P extends string>(steps: readonly Step<P>[], options: CoverageOptions<P>): GateResult<CoverageFinding> {
|
|
51
|
+
const out: CoverageFinding[] = [];
|
|
52
|
+
for (const row of planMatrix(steps, options.gaps ?? [], options.on, options.phases)) {
|
|
53
|
+
for (const cell of row) {
|
|
54
|
+
if (cell.steps.length > 0) continue;
|
|
55
|
+
const id = `${cell.on}/${cell.phase}`;
|
|
56
|
+
out.push(
|
|
57
|
+
cell.gap === undefined
|
|
58
|
+
? { level: "error", code: "no-step", record: "cell", id, message: `"${cell.on}" has no step in phase "${cell.phase}".` }
|
|
59
|
+
: { level: "error", code: "marked-gap", record: "cell", id, message: `"${cell.on}" has no step in phase "${cell.phase}". The gap gives the reason: ${cell.gap.why}` },
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return resultOf(out);
|
|
64
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
// The plans add-on of the guidebook: the time ladder, the steps of a plan by key and phase, the matrix of a library and the
|
|
1
|
+
// The plans add-on of the guidebook: the time ladder, the steps of a plan by key and phase, the matrix of a library, the step gate and the coverage gate.
|
|
2
2
|
// The add-on names no topic. A content package gives the steps of its topic.
|
|
3
3
|
|
|
4
4
|
export { LADDER, PHASES, PHASE_BOUNDS, PHASE_TITLES, SECONDS_PER_DAY, phaseIn, phaseOf, phasesOf } from "./ladder.ts";
|
|
5
5
|
export type { Ladder, Phase } from "./ladder.ts";
|
|
6
6
|
export { STEP_FINDING_CODES, checkSteps, planMatrix, stepsFor, unitsOf } from "./steps.ts";
|
|
7
7
|
export type { Cell, Gap, Step, StepFinding, StepFindingCode, StepGateOptions } from "./steps.ts";
|
|
8
|
+
export { COVERAGE_FINDING_CODES, HORIZONS, checkCoverage, coverageOf } from "./coverage.ts";
|
|
9
|
+
export type { CoverageFinding, CoverageFindingCode, CoverageOptions, KeyCoverage } from "./coverage.ts";
|