IF Commons GitHub

integrations/pure/types

The types of IFC Mizan Integrations (commons 0019-mizan-integrations FR-002, FR-006, FR-007): an integration as a typed record, the formats it reads and writes, a pinned standard, and the findings an import can end with, one sentence each. No any, no non-null !, and every switch over a union is exhaustive.

Source: commons/mizan/src/integrations/pure/types.ts

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

integrations.AnyIntegrationtypeno test imports it
type AnyIntegration = Integration<never, unknown>;

An integration whatever its input and output, as a registry holds it.

integrations.describeFindingfunctionno test imports it
function describeFinding(f: IntegrationFinding): string

A finding as one plain sentence.

integrations.Directiontypeno test imports it
type Direction = "import" | "export";

Whether an integration brings a standard in or puts our ontology out.

integrations.Formattypeno test imports it
type Format =
  "turtle" | "n-triples" | "json-ld" | "json-schema" | "shacl" | "skos" | "sql-code-lists" | "sssom" | "owl" | "rdf-xml" | "ts-vocabulary";

The formats an integration reads or writes: those built are the first two and the last; the rest are specified (0019-mizan-integrations FR-010).

integrations.Integrationtypeno test imports it
type Integration<In, Out> = {
  readonly id: string;
  readonly direction: Direction;
  readonly from: Format;
  readonly to: Format;
  readonly standard: string;
  readonly run: (input: In) => Promise<Result<Out, readonly IntegrationFinding[]>>;
};

An integration as a typed record: what it is, what it reads and writes, the standard it handles, and what it does.

integrations.IntegrationFindingtypeno test imports it
type IntegrationFinding = | { readonly kind: "no-license"; readonly standard: string } | { readonly kind: "not-redis… (885 characters)
type IntegrationFinding =
  | { readonly kind: "no-license"; readonly standard: string }
  | { readonly kind: "not-redistributable"; readonly standard: string }
  | { readonly kind: "pin-mismatch"; readonly standard: string; readonly expected: string; readonly actual: string }
  | { readonly kind: "syntax"; readonly line: number; readonly message: string }
  | {
      readonly kind: "loss";
      readonly what: "blank-node" | "collection" | "blank-node-object";
      readonly line: number;
      readonly about: string;
    }
  | { readonly kind: "slice-empty" }
  | { readonly kind: "term-missing"; readonly iri: string }
  | { readonly kind: "term-untyped"; readonly iri: string }
  | { readonly kind: "bad-name"; readonly name: string }
  | { readonly kind: "no-curie"; readonly iri: string }
  | { readonly kind: "unsupported"; readonly what: string; readonly about: string };

What an import or an export can end with instead of its output: one sentence each (describeFinding).

integrations.StandardRecordtypeno test imports it
type StandardRecord = { readonly id: string; readonly issuer: string; readonly name: string; readonly version: s… (403 characters)
type StandardRecord = {
  readonly id: string;
  readonly issuer: string;
  readonly name: string;
  readonly version: string;
  readonly location: string;
  /** An SPDX license identifier, or a `LicenseRef-` for what is not in the SPDX list. */
  readonly license: string;
  readonly redistributable: boolean;
  /** The SHA-256 of the source, in lower-case hexadecimal. */
  readonly sha256: string;
};

A standard as an import is pinned to it (0018-standards-first FR-006): who publishes it, its version, where, its license, whether its text may be copied, and the SHA-256 of the source.

AnyIntegrationtype
type AnyIntegration = Integration<never, unknown>;

An integration whatever its input and output, as a registry holds it.

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

describeFindingfunction
function describeFinding(f: IntegrationFinding): string

A finding as one plain sentence.

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

Directiontypeno test imports it
type Direction = "import" | "export";

Whether an integration brings a standard in or puts our ontology out.

Formattypeno test imports it
type Format =
  "turtle" | "n-triples" | "json-ld" | "json-schema" | "shacl" | "skos" | "sql-code-lists" | "sssom" | "owl" | "rdf-xml" | "ts-vocabulary";

The formats an integration reads or writes: those built are the first two and the last; the rest are specified (0019-mizan-integrations FR-010).

Integrationtypeno test imports it
type Integration<In, Out> = {
  readonly id: string;
  readonly direction: Direction;
  readonly from: Format;
  readonly to: Format;
  readonly standard: string;
  readonly run: (input: In) => Promise<Result<Out, readonly IntegrationFinding[]>>;
};

An integration as a typed record: what it is, what it reads and writes, the standard it handles, and what it does.

IntegrationFindingtypeno test imports it
type IntegrationFinding = | { readonly kind: "no-license"; readonly standard: string } | { readonly kind: "not-redis… (885 characters)
type IntegrationFinding =
  | { readonly kind: "no-license"; readonly standard: string }
  | { readonly kind: "not-redistributable"; readonly standard: string }
  | { readonly kind: "pin-mismatch"; readonly standard: string; readonly expected: string; readonly actual: string }
  | { readonly kind: "syntax"; readonly line: number; readonly message: string }
  | {
      readonly kind: "loss";
      readonly what: "blank-node" | "collection" | "blank-node-object";
      readonly line: number;
      readonly about: string;
    }
  | { readonly kind: "slice-empty" }
  | { readonly kind: "term-missing"; readonly iri: string }
  | { readonly kind: "term-untyped"; readonly iri: string }
  | { readonly kind: "bad-name"; readonly name: string }
  | { readonly kind: "no-curie"; readonly iri: string }
  | { readonly kind: "unsupported"; readonly what: string; readonly about: string };

What an import or an export can end with instead of its output: one sentence each (describeFinding).

StandardRecordtype
type StandardRecord = { readonly id: string; readonly issuer: string; readonly name: string; readonly version: s… (403 characters)
type StandardRecord = {
  readonly id: string;
  readonly issuer: string;
  readonly name: string;
  readonly version: string;
  readonly location: string;
  /** An SPDX license identifier, or a `LicenseRef-` for what is not in the SPDX list. */
  readonly license: string;
  readonly redistributable: boolean;
  /** The SHA-256 of the source, in lower-case hexadecimal. */
  readonly sha256: string;
};

A standard as an import is pinned to it (0018-standards-first FR-006): who publishes it, its version, where, its license, whether its text may be copied, and the SHA-256 of the source.

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

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