IF Commons GitHub

governance/module

Written to: 5 requirements: 5 proved, 0 partly, 0 failing, 0 with no test recorded. 0028-modules FR-001, 0028-modules FR-002, 0028-modules FR-003, 0028-modules FR-004, 0028-modules FR-005

Modules (commons data 0028-modules): a subject area as a value, composed with others into one domain. A module names the modules it requires and holds concepts and code lists that may refer to those of the modules it requires; a project lists the modules it wants and composeModules makes one domain of them, validated whole. A module that is not listed has no concept in the domain, so it has no table.

const billing = defineModule({ name: "billing", requires: ["party"], concepts: [invoice], codeLists: [] });
const app = composeModules("shop", { definition: "A shop" }, [moduleOf(partyDomain.value), billing]);

Source: commons/data/governance/module.ts

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

composeModulesfunction
function composeModules(name: string, spec: { readonly definition?: string | undefined; readonly annotations?: readonly Annotation[] | undefined; }, modules: readonly Module[]): Result<Domain, readonly ComposeError[]>

The domain of the modules a project lists.

ParameterWhat it is
namethe project's name for the domain, which the identities of its elements carry
specits definition and its own annotations
modulesthe modules, every one required by a listed module included

Returns: the domain, or every error

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

defineModuleconst
const defineModule: (spec: ModuleSpec) => Module

A module.

ParameterWhat it is
specits name, what it requires, its concepts and code lists

Returns: the module

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

Moduleinterface
interface Module

A subject area.

MemberTypeWhat it is
kind"module"
namestring
definitionstring
requiresreadonly string[]
conceptsreadonly AnyConcept[]
codeListsreadonly AnyCodeList[]
subject?stringThe id of the subject it applies to (subjects.ts), where it names one.

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

moduleOfconst
const moduleOf: (d: Domain, requires?: readonly string[]) => Module

A module made from a domain that is already valid.

ParameterWhat it is
dthe domain
requiresthe modules it requires, none where it stands alone

Returns: the module, named as the domain is

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

ModuleSpecinterfaceno test imports it
interface ModuleSpec

What a module is made from.

MemberTypeWhat it is
namestring
definition?string
requires?readonly string[]
conceptsreadonly AnyConcept[]
codeLists?readonly AnyCodeList[]
subject?string
withRequiredfunction
function withRequired(all: readonly Module[], wanted: readonly string[]): Result<readonly Module[], readonly ComposeError[]>

The modules a project gets from the names it wants: those and everything they require, in the order of the requirements.

ParameterWhat it is
allthe modules that exist
wantedthe names a project wants

Returns: the modules to compose, or why not

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

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