physical.Subjecttypeno test imports ittype Subject = { readonly id: string; readonly platform: string; readonly attributes?: Readonly<Record<string, string>> };What a check is run on.
The runner port (0005-grc-runners): a runner answers the question of a check, given the check's input, and says what it observed. The registry holds runners by their kind, which is their id; a runner is made by the unit that owns it from whatever it needs (a connection, a reader, a client), given as a small interface, so that this layer depends on none of them. runCheck makes the grc.result of a check on a subject: applicability, the runner, the judgement of what it observed, and never an exception.
import { createRunners, runCheck } from "./runner.ts";
const runners = createRunners();
// runners.register(sqlRunner(connection)); runCheck(runners, check, { id: "host-1", platform: "linux" }, clock)physical.Subjecttypeno test imports ittype Subject = { readonly id: string; readonly platform: string; readonly attributes?: Readonly<Record<string, string>> };What a check is run on.
physical.RunContexttypeno test imports ittype RunContext = {
readonly subject: Subject;
/** The clock: an ISO 8601 instant. */
readonly now: () => string;
/** How long a run may take. */
readonly timeoutMs: number;
readonly signal?: AbortSignal;
};What a runner is told besides the check.
physical.Observationtypeno test imports ittype Observation = {
readonly value: Json;
readonly observedAt: string;
/** How it was observed, in words. */
readonly via: string;
readonly tookMs: number;
readonly decided?: { readonly status: Status; readonly reason: string };
};What a runner observed; a runner that decides for itself (a person who has not answered) says so in decided.
physical.RunnerProblemtypeno test imports ittype RunnerProblem = { readonly kind: "refused" | "failed" | "unavailable" | "timeout"; readonly message: string };Why a runner gave no observation.
physical.Runnertypeno test imports ittype Runner = {
readonly id: string;
run(check: Check, ctx: RunContext): Promise<Result<Observation, RunnerProblem>>;
};A runner: its id is the kind a check names. A runner reads and never writes.
physical.Runnerstypeno test imports ittype Runners = Registry<Runner>;A registry of runners.
physical.createRunnersfunctionno test imports itfunction createRunners(): RunnersA registry of runners, empty.
physical.appliesfunctionno test imports itfunction applies(check: Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/co… (2120 characters)function applies(check: Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; }, platform: string): booleanWhether a check applies to a platform: it names none, or any, or the platform.
physical.runCheckfunctionno test imports itfunction runCheck(runners: Runners, check: Document & { readonly ask: string; readonly expect: import("/home/runner/work… (2739 characters)function runCheck(runners: Runners, check: Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; }, ctx: RunContext): Promise<Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; }>The result of one check on one subject: not-applicable where the platform is not one it applies to, error where there is no runner, the runner fails or throws, else the judgement of what was observed.
physical.runChecksfunctionno test imports itfunction runChecks(runners: Runners, checks: readonly (Document & { readonly ask: string; readonly expect: import("/home… (2893 characters)function runChecks(runners: Runners, checks: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; })[], subjects: readonly Subject[], options: { readonly now: () => string; readonly timeoutMs: number; readonly signal?: AbortSignal | undefined; }): Promise<readonly (Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; })[]>The results of every check on every subject, in the order of the checks and then the subjects; one that fails does not stop the others.
Subjecttypeno test imports ittype Subject = { readonly id: string; readonly platform: string; readonly attributes?: Readonly<Record<string, string>> };What a check is run on.
RunContexttypetype RunContext = {
readonly subject: Subject;
/** The clock: an ISO 8601 instant. */
readonly now: () => string;
/** How long a run may take. */
readonly timeoutMs: number;
readonly signal?: AbortSignal;
};What a runner is told besides the check.
Observationtypeno test imports ittype Observation = {
readonly value: Json;
readonly observedAt: string;
/** How it was observed, in words. */
readonly via: string;
readonly tookMs: number;
readonly decided?: { readonly status: Status; readonly reason: string };
};What a runner observed; a runner that decides for itself (a person who has not answered) says so in decided.
RunnerProblemtypeno test imports ittype RunnerProblem = { readonly kind: "refused" | "failed" | "unavailable" | "timeout"; readonly message: string };Why a runner gave no observation.
Runnertypetype Runner = {
readonly id: string;
run(check: Check, ctx: RunContext): Promise<Result<Observation, RunnerProblem>>;
};A runner: its id is the kind a check names. A runner reads and never writes.
Runnerstypeno test imports ittype Runners = Registry<Runner>;A registry of runners.
createRunnersfunctionfunction createRunners(): RunnersA registry of runners, empty.
appliesfunctionno test imports itfunction applies(check: Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/co… (2120 characters)function applies(check: Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; }, platform: string): booleanWhether a check applies to a platform: it names none, or any, or the platform.
runCheckfunctionfunction runCheck(runners: Runners, check: Document & { readonly ask: string; readonly expect: import("/home/runner/work… (2739 characters)function runCheck(runners: Runners, check: Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; }, ctx: RunContext): Promise<Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; }>The result of one check on one subject: not-applicable where the platform is not one it applies to, error where there is no runner, the runner fails or throws, else the judgement of what was observed.
runChecksfunctionfunction runChecks(runners: Runners, checks: readonly (Document & { readonly ask: string; readonly expect: import("/home… (2893 characters)function runChecks(runners: Runners, checks: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; })[], subjects: readonly Subject[], options: { readonly now: () => string; readonly timeoutMs: number; readonly signal?: AbortSignal | undefined; }): Promise<readonly (Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; })[]>The results of every check on every subject, in the order of the checks and then the subjects; one that fails does not stop the others.