Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-governance FR-001 , 0003-governance FR-003 , 0003-governance FR-004
The model of governance (commons data 0003-governance FR-001 , FR-003 , FR-004 ): concepts with attributes, identifying attributes and relationships, code lists, and the domain that holds them. The constructors are total, they never fail; domain checks the whole and returns the domain or every error, as data. The names of a concept's attributes and relationships are literal types, so an identifying attribute the concept does not have does not compile.
const party = concept ("party" , {
definition: "A person or an organization we deal with" ,
attributes: { party_id: attribute (identifier (), { definition: "Its identifier" }), name: attribute (text (), { definition: "What it is called" }) },
identifiedBy: ["party_id" ],
});
const arca = domain ("arca" , { definition: "Parties" , concepts: [party] });Source: commons/data/governance/model.ts
8 of 21 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.
Attributeinterface no test imports it interface Attribute <T extends Datatype = Datatype , M extends Multiplicity = Multiplicity >An attribute of a concept.
Member Type What it is kind"attribute"typeTmultiplicityMdefinitionstringannotationsreadonly Annotation[]
AttributeOptionsinterface no test imports it interface AttributeOptions <M extends Multiplicity = Multiplicity >What attribute is given besides the datatype.
Member Type What it is definition?stringmultiplicity?Mannotations?readonly Annotation[]
Attrstype no test imports it type Attrs = Readonly <Record <string , Attribute >>;The attributes of a concept, by name.
type AnyConcept = Concept <string , Attrs , Rels , string >;A concept of any name, attributes and relationships.
Imported by 62 tests of the run (62 passed, 0 failed): the library's results
function attribute : { <T extends Datatype >(type : T , options ?: RequiredOptions | undefined ): Attribute <T , "required" >; <T extends Datatype , const M extends Multiplicity >(type : T , options : AttributeOptions <M > & { readonly multiplicity : M ; }): Attribute <T , M >; }Makes an attribute; total. It is required unless it says otherwise.
Parameter What it is typewhat kind of fact it holds optionsits definition, multiplicity and annotations
Returns: the attribute, frozen
Imported by 148 tests of the run (148 passed, 0 failed): the library's results
Cardinalitytype no test imports it type Cardinality = "one" | "optional" | "many" ;How many of the target a concept relates to: exactly one, at most one, or any number.
Conceptinterface no test imports it interface Concept <N extends string = string , A extends Attrs = Attrs , R extends Rels = Rels , I extends string = string >A concept: a thing the business talks about.
Member Type What it is kind"concept"nameNdefinitionstringattributesArelationshipsRidentifiedByreadonly I[]The names of the attributes and relationships that identify it; concept checked them against its own, as literal types, when it was made. annotationsreadonly Annotation[]
ConceptSpecinterface no test imports it interface ConceptSpec <A extends Attrs , R extends Rels , I extends string >What concept is given.
Member Type What it is definition?stringattributesAidentifiedByreadonly I[]What identifies it: names of its own attributes, or of its own relationships of cardinality one, which make it a specialization of what they point to, or it does not compile. relationships?Rannotations?readonly Annotation[]
function concept <const N extends string , const A extends Attrs , const I extends (keyof NoInfer <A > | keyof NoInfer <R >) & string , const R extends Rels = Record <never , Relationship <Cardinality , Target >>>(name : N , spec : ConceptSpec <A , R , I >): Concept <N , A , R , I >Makes a concept; total. Its attribute names, relationship names and identifying attributes are literal types.
Parameter What it is nameits name specits definition, attributes, identifying attributes, relationships and annotations
Returns: the concept, frozen
Imported by 148 tests of the run (148 passed, 0 failed): the library's results
function domain (name : string , spec : DomainSpec ): Result <Domain , readonly DomainError []>Makes a domain, or says everything that is wrong with it.
Parameter What it is nameits name specits definition, concepts, code lists and annotations
Returns: the domain, or every error
Imported by 100 tests of the run (100 passed, 0 failed): the library's results
interface Domain A domain: a part of the business, with its concepts and code lists.
Member Type What it is kind"domain"namestringdefinitionstringconceptsreadonly AnyConcept[]codeListsreadonly AnyCodeList[]annotationsreadonly Annotation[]
Imported by 30 tests of the run (30 passed, 0 failed): the library's results
DomainErrortype no test imports it type DomainError =
| { readonly kind: "name"; readonly element: ElementId; readonly name: string }
| { readonly kind… (692 characters) type DomainError =
| { readonly kind : "name" ; readonly element : ElementId ; readonly name : string }
| { readonly kind : "duplicate" ; readonly element : ElementId }
| { readonly kind : "unresolved" ; readonly from : ElementId ; readonly to : string ; readonly what : "concept" | "codelist" }
| {
readonly kind : "identifier" ;
readonly concept : ElementId ;
readonly attribute ?: string ;
readonly why : "missing" | "unknown" | "not-required" ;
}
| { readonly kind : "annotation" ; readonly element : ElementId ; readonly annotation : string ; readonly about : readonly ElementKind [] }
| { readonly kind : "dimensions" ; readonly element : ElementId ; readonly dimensions : number };What is wrong with a domain; domain returns all of it together.
DomainSpecinterface no test imports it interface DomainSpec What domain is given.
Member Type What it is definition?stringconceptsreadonly AnyConcept[]codeLists?readonly AnyCodeList[]annotations?readonly Annotation[]
Multiplicitytype no test imports it type Multiplicity = "required" | "optional" | "many" ;Whether an attribute is held once and always, at most once, or any number of times.
membersOfconst no test imports it const membersOf : (c : AnyConcept ) => readonly string []The names of the members of a concept: its attributes, then its relationships.
Relationshipinterface no test imports it interface Relationship <C extends Cardinality = Cardinality , T extends Target = Target >A relationship from a concept to another.
Member Type What it is kind"relationship"toTcardinalityCdefinitionstringannotationsreadonly Annotation[]
RelationshipOptionsinterface no test imports it interface RelationshipOptions <C extends Cardinality = Cardinality >What relationship is given besides the target.
Member Type What it is cardinalityCdefinition?stringannotations?readonly Annotation[]
function relationship <const T extends Target , const C extends Cardinality >(to : T , options : RelationshipOptions <C >): Relationship <C , T >Makes a relationship; total.
Parameter What it is tothe concept it points to, or a function that gives it optionsits cardinality, definition and annotations
Returns: the relationship, frozen
Imported by 75 tests of the run (75 passed, 0 failed): the library's results
function resolve (target : Target ): AnyConcept The concept a target gives.
Imported by 15 tests of the run (15 passed, 0 failed): the library's results
Relstype no test imports it type Rels = Readonly <Record <string , Relationship >>;The relationships of a concept, by name.
type Target = AnyConcept | (() => AnyConcept );The concept a relationship points to: the concept, or a function that gives it, so that two concepts may refer to each other.
Imported by 7 tests of the run (7 passed, 0 failed): the library's results