IF Commons GitHub

logical/serializer

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-grc-documents FR-005

The serializer port (0004-grc-documents FR-005): a plugin that writes an assessment in an exchange format. The registry holds them by stable id; the formats themselves are in units of their own (src/serializers/<id>/), and nothing here names one.

Source: commons/grc/src/logical/serializer.ts

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

logical.SerializeContexttypeno test imports it
type SerializeContext = {
  /** Crosswalks, so that a control is written under another framework's identifier. */
  readonly crosswalks?: readonly Crosswalk[];
  /** The predicate type of a statement, where the format has one. */
  readonly predicateType?: string;
  readonly options?: Readonly<Record<string, Json>>;
};

What a serializer may be given besides the assessment.

logical.SerializeProblemtypeno test imports it
type SerializeProblem = { readonly kind: "unsupported" | "invalid"; readonly message: string };

Why an assessment could not be written.

logical.Serializertypeno test imports it
type Serializer = {
  readonly id: string;
  /** The name of the format. */
  readonly format: string;
  /** The version of the format it writes. */
  readonly version: string;
  readonly media: string;
  serialize(assessment: Assessment, context: SerializeContext): Promise<Result<string, SerializeProblem>>;
};

A serializer: deterministic (the same assessment gives the same bytes) and never reading the clock.

logical.Serializerstypeno test imports it
type Serializers = Registry<Serializer>;

A registry of serializers.

logical.createSerializersfunctionno test imports it
function createSerializers(): Serializers

A registry of serializers, empty.

SerializeContexttypeno test imports it
type SerializeContext = {
  /** Crosswalks, so that a control is written under another framework's identifier. */
  readonly crosswalks?: readonly Crosswalk[];
  /** The predicate type of a statement, where the format has one. */
  readonly predicateType?: string;
  readonly options?: Readonly<Record<string, Json>>;
};

What a serializer may be given besides the assessment.

SerializeProblemtypeno test imports it
type SerializeProblem = { readonly kind: "unsupported" | "invalid"; readonly message: string };

Why an assessment could not be written.

Serializertypeno test imports it
type Serializer = {
  readonly id: string;
  /** The name of the format. */
  readonly format: string;
  /** The version of the format it writes. */
  readonly version: string;
  readonly media: string;
  serialize(assessment: Assessment, context: SerializeContext): Promise<Result<string, SerializeProblem>>;
};

A serializer: deterministic (the same assessment gives the same bytes) and never reading the clock.

Serializerstypeno test imports it
type Serializers = Registry<Serializer>;

A registry of serializers.

createSerializersfunction
function createSerializers(): Serializers

A registry of serializers, empty.

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

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