IF Commons GitHub

sql/logical/project

Written to: 9 requirements: 9 proved, 0 partly, 0 failing, 0 with no test recorded. 0006-logical FR-003, 0006-logical FR-004, 0006-logical FR-005, 0006-logical FR-006, 0006-logical FR-007, 0006-logical FR-008 and 3 more

The normalized projection (commons data 0006-logical): a domain made into a logical schema, one table for each concept and for each open code list, the columns and keys that the attributes and relationships say, the constraints and indexes the vocabularies say, and the names, as lists of words, that 0005-naming says. It returns the schema and a report of the flow, or every error together. A Projection is a value: this is the library's own, and another takes its place.

What the schema cannot express itself, it carries: the annotations of privacy, security, ownership, requirements and the rest stay on the tables and columns that were made from what they were on, so that a layer or an extension below may express them, and the report says so.

Source: commons/data/sql/logical/project.ts

5 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.

Dispositiontypeno test imports it
type Disposition = "expressed" | "carried" | "unexpressed";

Where an annotation ended.

FlowEntryinterfaceno test imports it
interface FlowEntry

What became of one annotation of governance.

MemberTypeWhat it is
elementElementId
indexnumberThe annotation's position among the element's annotations.
annotation`${string}.${string}`
dispositionDisposition
logicalreadonly LogicalId[]The logical elements it became, or that carry it.
note?string
normalizedconstno test imports it
const normalized: Projection

The normalized projection, with the library's vocabularies.

normalizedProjectionfunction
function normalizedProjection(options?: ProjectionOptions): Projection

The normalized projection with its options.

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

Projectedinterface
interface Projected

A logical schema and the report of the flow of governance into it.

MemberTypeWhat it is
schemaLogicalSchema
flowreadonly FlowEntry[]

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

Projectiontype
type Projection = (domain: Domain) => Result<Projected, readonly ProjectionError[]>;

A projection: a value that makes a logical schema from a domain.

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

ProjectionErrortypeno test imports it
type ProjectionError = | { readonly kind: "collision"; readonly what: "table" | "column" | "constraint"; … (512 characters)
type ProjectionError =
  | {
      readonly kind: "collision";
      readonly what: "table" | "column" | "constraint";
      readonly name: Words;
      readonly table?: Words;
      readonly first: ElementId;
      readonly second: ElementId;
    }
  | {
      readonly kind: "member";
      readonly concept: ElementId;
      readonly member: string;
      readonly why: "unknown" | "not-a-column" | "not-one-column";
    }
  | { readonly kind: "identity"; readonly concept: ElementId; readonly why: "cycle" };

What is wrong with a projection; project returns all of it together.

ProjectionOptionsinterfaceno test imports it
interface ProjectionOptions

What a projection may be told besides the domain.

MemberTypeWhat it is
carry?readonly `${string}.${string}`[]Kinds of annotation, besides the library's own vocabularies', that the schema carries.
projectDomainfunction
function projectDomain(domain: Domain, projection?: Projection): Result<Projected, readonly ProjectionError[]>

The logical schema of a domain.

ParameterWhat it is
domainthe domain
projectionhow to project it; the normalized projection where none is given

Returns: the schema and the report of the flow, or every error of the projection

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

referenceWordsfunction
function referenceWords(relationship: string, target: string, key: Words): Words

The words of the column that refers to a column of a target's key (0005-naming FR-003).

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

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