Index

src/app/utils/style-utils.ts

addAlphaToHexColor
addAlphaToHexColor(color: unknown, opacity: unknown)
Parameters :
Name Type Optional
color unknown No
opacity unknown No

src/app/features/inherited-field/add-missing-values.ts

addAndRemoveValues
addAndRemoveValues(existingValues: any, valuesToAdd: any, valuesToRemove)

Add the given values to the existing values (skipping duplicates) and remove the values to remove.

Parameters :
Name Type Optional Default value Description
existingValues any No

values already set (database format)

valuesToAdd any No

new values to be added (database format)

valuesToRemove No []

values to be removed from the existing values (database format)

Returns : any

the combined values or the unchanged existingValues if nothing was added or removed

addMissingValues
addMissingValues(existingValues: any, valuesToAdd: any)

Append the given values to the existing values, skipping any duplicates.

Parameters :
Name Type Optional Description
existingValues any No

values already set (database format)

valuesToAdd any No

new values to be added (database format)

Returns : any

the combined values or the unchanged existingValues if all values are already included

src/app/child-dev-project/notes/add-default-note-views.ts

addDefaultNoteViewsToConfig
addDefaultNoteViewsToConfig(configData: Record)
Parameters :
Name Type Optional
configData Record No
getDefaultNoteDetailsConfig
getDefaultNoteDetailsConfig()

Default configuration for Note Details.

Returns : NoteDetailsConfig

src/app/features/change-history/change-history-normalize.ts

additions
additions(snapshot: Record)

every (non-hidden) field of a snapshot rendered as an addition

Parameters :
Name Type Optional
snapshot Record No
Returns : FieldChange[]
applyDelta
applyDelta(state: Record, delta)

apply a jsondiffpatch delta to a deep clone of the current state

Parameters :
Name Type Optional
state Record No
delta No
Returns : Record<string, unknown>
buildChangeEvents
buildChangeEvents(rawDocs)

Build the displayable change history for one entity from its raw audit docs.

A jsondiffpatch update-delta only encodes what changed (e.g. items added to an array by index), not the full prior value — so per-field before/after cannot be read from a single delta. Instead the full document state is replayed: starting from the create/baseline snapshot and applying each update delta in chronological order, the before/after of every field (including multi-value arrays) is the difference between consecutive full states.

Parameters :
Name Optional
rawDocs No
Returns : ChangeEvent[]

events newest-first

byChronology
byChronology(a: RawAuditDoc, b: RawAuditDoc)

chronological: by server timestamp, then by revision generation

Parameters :
Name Type Optional
a RawAuditDoc No
b RawAuditDoc No
Returns : number
changedFieldsOf
changedFieldsOf(doc: AuditDelta)

The names of the fields one audit record changed, read directly from its raw diff, without replaying the entity's full document state.

This is what the system-wide change log needs: a top-level jsondiffpatch delta is already keyed by field name, so the names (unlike the before/after values, see buildChangeEvents) need no prior state. That makes a row renderable from its own audit doc alone, so the log can page over records of many different entities without loading a history per entity.

A delete returns no fields on purpose: a deletion replicates as a tombstone stripped of its content, so the delta would list every field of the record as removed rather than the one thing that happened.

Parameters :
Name Type Optional
doc AuditDelta No
Returns : string[]
fieldChanges
fieldChanges(prev: Record, next: Record)

the (non-hidden) fields whose full value differs between two states

Parameters :
Name Type Optional
prev Record No
next Record No
Returns : FieldChange[]
isHidden
isHidden(field: string)
Parameters :
Name Type Optional
field string No
Returns : boolean
revGeneration
revGeneration(rev?: string)
Parameters :
Name Type Optional
rev string Yes
Returns : number
snapshotOf
snapshotOf(doc: AuditDelta)

the full document snapshot carried by a baseline (raw doc) or create ([doc]) record

Parameters :
Name Type Optional
doc AuditDelta No
Returns : Record<string, unknown>

src/app/child-dev-project/notes/deprecated/legacy-note-link-fields.testing.ts

addLegacyNoteFieldsToSchema
addLegacyNoteFieldsToSchema()

Add the legacy children, schools and childrenAttendance fields to the Note schema.

Note that this only restores the schema, not the array initializers the Note class used to have: a test filling one of these fields has to assign the array itself (e.g. note.children = []).

removeLegacyNoteFieldsFromSchema
removeLegacyNoteFieldsFromSchema()

Remove the legacy fields again, restoring the schema as defined in code.

src/app/core/entity/database-field.decorator.ts

addPropertySchema
addPropertySchema(target: unknown, propertyName: string, propertySchema: EntitySchemaField)
Parameters :
Name Type Optional
target unknown No
propertyName string No
propertySchema EntitySchemaField No
DatabaseField
DatabaseField(propertySchema: EntitySchemaField)

Decorator (Annotation @DatabaseField()) to mark a property of an Entity that should be persisted in the database.

also see

Parameters :
Name Type Optional Default value Description
propertySchema EntitySchemaField No {}

(optional) SchemaField definition that configures additional options regarding this field

getEntitySchema
getEntitySchema(ctor: unknown)

Returns the schema map of this entity (not the superclass). Creates and assigns a new one if it doesn't exist yet.

Parameters :
Name Type Optional
ctor unknown No
Returns : EntitySchema

src/app/utils/utils.ts

addToGroup
addToGroup(allGroups: unknown, currentValue: unknown, currentElement: unknown)
Parameters :
Name Type Optional
allGroups unknown No
currentValue unknown No
currentElement unknown No
calculateAge
calculateAge(dateOfBirth: Date)
Parameters :
Name Type Optional
dateOfBirth Date No
Returns : number
compareEnums
compareEnums(a: ConfigurableEnumValue, b: ConfigurableEnumValue)
Parameters :
Name Type Optional
a ConfigurableEnumValue No
b ConfigurableEnumValue No
Returns : boolean
dateToString
dateToString(value: Date)
Parameters :
Name Type Optional
value Date No
equals
equals(a: unknown, b: unknown)

Comparing two values for equality that might be different than just object equality

Parameters :
Name Type Optional
a unknown No
b unknown No
Returns : boolean
getParentUrl
getParentUrl(router: Router)
Parameters :
Name Type Optional
router Router No
Returns : string
getUrlWithoutParams
getUrlWithoutParams(router: Router)
Parameters :
Name Type Optional
router Router No
Returns : string
groupBy
groupBy<T, P extends keyof T, E>(array, propertyToGroupBy: P)
Type parameters :
  • T
  • P extends keyof T
  • E

Group an array by the given property.

Parameters :
Name Type Optional Description
array No

A simple array to be grouped.

propertyToGroupBy P No

The key of the property in the elements by whose value the result is grouped. If this is an array, grouped by individual elements.

Returns : unknown[]

an array where the first entry is the value of this group and the second all entries that have this value.

isValidDate
isValidDate(date: any)
Parameters :
Name Type Optional
date any No
Returns : boolean
mapInBatches
mapInBatches<T, R>(items, batchSize: number, fn)
Type parameters :
  • T
  • R

Apply an async function to all items, but only run batchSize of them at the same time.

Unlike a plain Promise.all(items.map(...)) this does not fire all requests at once, which can exhaust the browser's resources (net::ERR_INSUFFICIENT_RESOURCES) for large lists. The result keeps the order of the input. If any call rejects, no further batches are started.

Parameters :
Name Type Optional Description
items No

the items to process

batchSize number No

maximum number of items processed in parallel

fn No

async function applied to each item

Returns : Promise<R[]>
readFile
readFile(file: Blob)
Parameters :
Name Type Optional
file Blob No
Returns : Promise<string>
readFileAsArrayBuffer
readFileAsArrayBuffer(file: Blob)

Read the contents of a Blob into an ArrayBuffer. Use this for binary formats (e.g. xlsx) where reading as text would corrupt the payload.

Parameters :
Name Type Optional
file Blob No
Returns : Promise<ArrayBuffer>
serviceProvider
serviceProvider<T>(service, factory)
Type parameters :
  • T

This is a simple shorthand function to create factories for services. The use case is, when multiple services extend the same class and one of these services will be provided.

Parameters :
Name Optional Description
service No

the token for which a service is provided

factory No

factory which returns a subtype of class

Returns : FactoryProvider
sortByAttribute
sortByAttribute<OBJECT>(attribute, order)
Type parameters :
  • OBJECT
Parameters :
Name Optional Default value
attribute No
order No "asc"
Returns : number

src/app/features/inherited-field/automated-field-update/change-set.ts

addToLinkIndex
addToLinkIndex(index: LinkIndex, id: string, record: ChangedRecord)
Parameters :
Name Type Optional
index LinkIndex No
id string No
record ChangedRecord No
Returns : void
getChangedFields
getChangedFields(after: Entity, before: Entity)

The ids of the fields whose value differs between the state of a record after and before a change.

Parameters :
Name Type Optional
after Entity No
before Entity No
Returns : string[]
isFieldChanged
isFieldChanged(after: Entity, before: Entity, fieldId: string)

Whether the value of a field differs between the state of a record after and before a change.

Parameters :
Name Type Optional
after Entity No
before Entity No
fieldId string No
Returns : boolean
isLinkedTo
isLinkedTo(record, referenceField: string, id: string)

Whether the record links to the given id in the given field (also if the link is stored without the type prefix of the id).

Parameters :
Name Type Optional
record No
referenceField string No
id string No
Returns : boolean

src/app/features/skill/link-external-profile/link-external-profile-dialog/link-external-profile-dialog.component.ts

addTooltip
addTooltip(profile: ExternalProfile)
Parameters :
Name Type Optional
profile ExternalProfile No

src/app/core/basic-datatypes/date-with-age/age-limit.ts

ageRangeValidator
ageRangeValidator(end, ageRange: AgeRange)

Creates the validator for one end of the configured age range. The error also carries the other end, if configured, to word it as a range ("between ... and ...").

Parameters :
Name Type Optional
end No
ageRange AgeRange No
Returns : ValidatorFn
descriptionForAgeValidator
descriptionForAgeValidator(validator, validationValue: any)
Parameters :
Name Type Optional
validator No
validationValue any No
Returns : string

src/app/core/database/pouchdb/find-queries.ts

allOfSelectors
allOfSelectors(...selectors: undefined)

Combine Mango selectors so that a document has to match all of them, leaving out empty ones (and the $and itself if only one is left).

Parameters :
Name Optional
selectors No
Returns : PouchDB.Find.Selector
sortedQueries
sortedQueries(prefix: string, query, sort)

The two queries that together return an entity type's documents sorted by a property, in the order in which to page through them.

A Mango index only contains the documents that have every indexed field (and cannot be told to treat a missing one like null), so a query sorted through an index on the property skips all documents without a value for it. These are queried separately, through a partial index containing only them.

Parameters :
Name Type Optional Description
prefix string No

the entity type, i.e. the prefix of its documents' ids

query No

the Mango selector to filter by

sort No

the property and direction to sort by

Returns : unknown
typeSelector
typeSelector(prefix: string)

Selector matching all documents of one entity type.

Parameters :
Name Type Optional Description
prefix string No

the entity type, i.e. the prefix of its documents' ids

Returns : PouchDB.Find.Selector

src/app/core/config/config-migrations.ts

applyConfigMigrations
applyConfigMigrations<E>(doc: E)
Type parameters :
  • E

Apply all config migrations to a plain JSON document. Returns the migrated document as a plain object (no Angular entity re-hydration). Used by the admin CLI; ConfigService wraps this and also applies the defaults that feature modules register in the DefaultConfigMigrationRegistryService before calling this, so the migrations above can see those default-added view configs too.

Parameters :
Name Type Optional
doc E No
Returns : E

src/bootstrap-i18n.ts

applyDocumentLanguage
applyDocumentLanguage(locale: string)

Must run before Angular bootstraps: the CDK's Directionality reads dir once when constructed, and all Angular Material components take their direction from it.

Parameters :
Name Type Optional
locale string No
Returns : void
fetchTranslations
fetchTranslations(locale: string)
Parameters :
Name Type Optional
locale string No
Returns : Promise<Record | undefined>
initLanguage
initLanguage(locale?: string)

Load translation files and apply them to angular localize system.

Parameters :
Name Type Optional Description
locale string Yes

(Optional) overwrite the locale to use (otherwise loaded from local storage)

Returns : Promise<void>
registerLocaleDataFor
registerLocaleDataFor(locale: string)

Needed for locale-aware components & pipes (date formats, first day of week, numbers). Imports are listed explicitly so only the locales we offer end up in the bundle.

Parameters :
Name Type Optional
locale string No
Returns : Promise<void>

src/bootstrap-environment.ts

applyOnlineOnlyPreference
applyOnlineOnlyPreference()

If the user previously opted into online-only mode, override session_type early so that database instances are created with the correct type from the start.

This MUST run before Angular bootstraps, because DatabaseFactoryService reads environment.session_type the first time a database is lazily accessed (during Angular DI startup, before LoginComponent even exists). If we waited until LoginComponent ran, the wrong DB class would already have been instantiated.

The flow is:

  1. User toggles checkbox on login page → LoginComponent writes localStorage and reloads the page
  2. On reload, this function runs and applies the preference to environment
  3. Angular DI starts → correct DB class (RemotePouchDatabase) is created

See also: LoginComponent.onOnlineOnlyChanged() and ONLINE_ONLY_KEY.

applyPublicFormSession
applyPublicFormSession()

Force online-only mode when bootstrapping a public-form route, so the database factory creates a RemotePouchDatabase from the first lazy access rather than a SyncedPouchDatabase that would never be initialized.

initConfigJsonToEnvironment
initConfigJsonToEnvironment()

Load basic config values from assets/keycloak.json into environment

initEnvironmentConfig
initEnvironmentConfig()

Overwrite environment settings with the settings from the config.json if present. If no file is found, the environment settings are kept.

initFirebaseConfigToEnvironment
initFirebaseConfigToEnvironment()

Load Push Notifications config for Firebase. Please add assets/firebase-config.json with your own Firebase config

initKeycloakConfigToEnvironment
initKeycloakConfigToEnvironment()

Load Keycloak server URL from assets/keycloak.json into environment

isPublicFormRoute
isPublicFormRoute()
Returns : boolean

src/app/core/common-components/entities-table/entities-table-selection.ts

applyRangeSelection
applyRangeSelection<T extends Entity>(selectedRecords, records, range, shouldCheck: boolean)
Type parameters :
  • T extends Entity

Applies a contiguous shift-selection update over a row index range.

Parameters :
Name Type Optional
selectedRecords No
records No
range No
shouldCheck boolean No
Returns : T[]
isCheckboxTarget
isCheckboxTarget(target)

Detects whether the click originated from a checkbox input.

Parameters :
Name Optional
target No
Returns : boolean
isClickableTarget
isClickableTarget(target)

Detects whether the click target is inside an element marked as .clickable.

Parameters :
Name Optional
target No
Returns : boolean
toggleRecordSelection
toggleRecordSelection<T extends Entity>(selectedRecords, record: T, checked: boolean)
Type parameters :
  • T extends Entity

Adds or removes a single record from the selected records collection.

Parameters :
Name Type Optional
selectedRecords No
record T No
checked boolean No
Returns : T[]
updateSelectionFromMouseDown
updateSelectionFromMouseDown<T extends Entity>(input: MouseSelectionInput)
Type parameters :
  • T extends Entity

Computes the next selection state for a row mousedown, including shift-range behavior.

Parameters :
Name Type Optional
input MouseSelectionInput No

src/app/core/basic-datatypes/schema-embed/schema-embed-array-entry-change.ts

applySchemaEmbedArrayEntryChange
applySchemaEmbedArrayEntryChange(entries, change: SchemaEmbedArrayEntryChange)

Apply the change of a single entry to the latest list of entries, keeping all other entries as they are now.

Parameters :
Name Type Optional Description
entries No

the latest entries of the field (not mutated)

change SchemaEmbedArrayEntryChange No

the change made in the popup of an entry

Returns : Record[]

the changed list of entries

Throws :
  • SchemaEmbedArrayEntryConflictError if the edited or deleted entry has been changed or removed in the meantime

findCurrentIndex
findCurrentIndex(entries, index: number, original)

Find the position of the opened entry within the latest entries, which may have moved if other entries were added or removed in the meantime.

Parameters :
Name Type Optional
entries No
index number No
original No
Returns : number
isStoredEntry
isStoredEntry(entry: Record, savedEntries)

Whether the entry is stored in its record, as opposed to only added in a form that is not saved yet.

Parameters :
Name Type Optional Description
entry Record No

the entry to check

savedEntries No

the entries of the field as saved in the record

Returns : boolean
markStoredEntry
markStoredEntry(entry: Record)

Remember that the entry stems from an entry stored in its record, see isStoredEntry.

Parameters :
Name Type Optional
entry Record No

src/app/core/common-components/entities-table/entities-table-sort.store.ts

applySortingRules
applySortingRules(columns, getDatatypeOrDefault)

Applies sorting rules to columns: disables sorting for entity references, untyped columns, and arrays (unless the datatype provides custom sort logic).

Parameters :
Name Optional
columns No
getDatatypeOrDefault No
Returns : FormFieldConfig[]
inferDefaultSort
inferDefaultSort(colsToDisplay, columns, getDatatypeOrDefault)

Infers a stable default sort from visible sortable columns. Date-like columns default to descending order.

Parameters :
Name Optional
colsToDisplay No
columns No
getDatatypeOrDefault No
Returns : Sort | undefined
resolveAgeSourceField
resolveAgeSourceField(column: FormFieldConfig)

Resolve the source field for virtual DisplayAge columns.

These columns display an age from another field, e.g. age reads record.dateOfBirth.age, so datatype sorting cannot use the column value directly. The legacy age and age_<field> conventions remain supported for existing configs.

Parameters :
Name Type Optional
column FormFieldConfig No
Returns : string | undefined

src/app/core/entity/entity-mapper/entity-mapper.service.ts

applyStoredRevisions
applyStoredRevisions(entities, results)

Copy the revisions the database assigned back onto the saved entities.

Matched by id rather than by position, so that a result missing from the response cannot shift revisions onto other entities.

Parameters :
Name Optional
entities No
results No
storedRecordsOf
storedRecordsOf(records, error)

The records that were stored although the save as a whole was rejected.

A rejected save reports what became of the records (see Database.putAll): the results array when individual records failed, a PartialBulkWriteError when the write stopped partway. Any other rejection means nothing was stored.

Parameters :
Name Optional
records No
error No
Returns : Entity[]

src/app/core/basic-datatypes/entity/edit-entity/edit-entity.component.ts

applyTextToCreatedEntity
applyTextToCreatedEntity(entity: Entity, input: string)

Update the given entity by applying the text entered by a user to the most likely appropriate entity field, inferred from the toString representation.

Parameters :
Name Type Optional
entity Entity No
input string No

src/app/core/entity/model/entity-update.ts

applyUpdate
applyUpdate<T extends Entity>(entities, next: UpdatedEntity, addIfMissing: boolean)
Type parameters :
  • T extends Entity

Updates a list of entities given an updated version of the entity. This updated version can either be a new entity (that should be inserted into the list), or an existing entity that should be updated or deleted. The given array will not be mutated but will be returned when the given new entity or type is illegal

Parameters :
Name Type Optional Default value Description
entities No

The entities to update, must be defined

next UpdatedEntity No

An entity that should be updated as well as the type of update. This, as well as the entity may be undefined or null. In this event, the entities-array is returned as is.

addIfMissing boolean No true

(Optional) whether to add an entity that comes through an update event but is not part of the array yet, default is to add, disable this if you do special filtering or calculations on the data

Returns : T[]

An array of the given entities with the update applied

src/app/core/entity-details/entity-actions-menu/entity-actions-grouping.ts

asActionEntry
asActionEntry(action: EntityAction)
Parameters :
Name Type Optional
action EntityAction No
groupEntityActions
groupEntityActions(actions)

Collapse actions sharing a group into one submenu entry. A group of one stays a plain item, as a submenu of one only adds a click.

Parameters :
Name Optional
actions No

src/app/utils/asArray.ts

asArray
asArray<T>(x)
Type parameters :
  • T

Convert wrap a value in an array if it is not already an array.

Parameters :
Name Optional
x No
Returns : T[]

src/app/core/basic-datatypes/schema-embed/schema-embed-export-columns.ts

asEntries
asEntries(value)
Parameters :
Name Optional
value No
Returns : Record[]
formatEntry
formatEntry(entry: Record, innerFields, context?: ExportContext)

The values of all inner fields of one entry, leaving out empty ones.

Parameters :
Name Type Optional
entry Record No
innerFields No
context ExportContext Yes
Returns : Promise<string>
getInnerExportFields
getInnerExportFields(innerSchema: EntitySchema, entitySchemaService: EntitySchemaService)

The inner fields with a formatter each, using the readable export column of their datatype (e.g. the name rather than the id of a referenced entity).

Parameters :
Name Type Optional
innerSchema EntitySchema No
entitySchemaService EntitySchemaService No
Returns : InnerExportField[]
getSchemaEmbedExportColumns
getSchemaEmbedExportColumns(schemaField: EntitySchemaField, innerSchema: EntitySchema, holdsArray: boolean, entitySchemaService: EntitySchemaService)

Export columns of a schema-embed field, built from its inner fields, each formatted like a top-level field of the same datatype (e.g. names of referenced entities, enum labels).

  • single embedded object: one column per inner field
  • array of embedded objects: one column with all entries (preselected), one column per inner field with the values of all entries (offered, but not preselected) and one with the number of entries (preselected)
Parameters :
Name Type Optional Description
schemaField EntitySchemaField No

the field using a schema-embed datatype

innerSchema EntitySchema No

the inner fields of the embedded objects

holdsArray boolean No

whether the field holds an array of embedded objects

entitySchemaService EntitySchemaService No

to look up the inner fields' datatypes

Returns : ExportColumnMapping[]
mapEntries
mapEntries(value, format)

Format all entries, in batches as they may load referenced entities.

Parameters :
Name Optional
value No
format No
Returns : Promise<string[]>

src/app/features/change-history/change-history.module.ts

asSingle
asSingle(entity)
Parameters :
Name Optional
entity No
Returns : Entity | undefined

src/app/features/change-history/audit-filter.ts

authorFilterOptions
authorFilterOptions(authors)

One filter option per record a login account can belong to.

Matched on every shape the author can be recorded in: the backend writes what the access token carried, which is the record's id where the account names one and the plain username otherwise. The username is the record id without its type prefix, which is how an account without an explicit id is linked to its record in the first place (see KeycloakAuthService).

Parameters :
Name Optional
authors No
entityTypeFilterOptions
entityTypeFilterOptions(types)

One filter option per entity type, each selecting that type's records by a prefix range on the raw stored id.

It is legal in a selector even though AuditRecord declares no property of that name - see the class.

Parameters :
Name Optional
types No
operationFilterOptions
operationFilterOptions()

One filter option per operation the log lets the user narrow to.

src/app/core/config/multi-lingual-config.ts

baseLanguage
baseLanguage(locale: string)

Reduce a locale id to its language subtag, e.g. en-US -> en.

Parameters :
Name Type Optional
locale string No
Returns : string
isNonEmptyString
isNonEmptyString(value)
Parameters :
Name Optional
value No
Returns : string
isTranslatableText
isTranslatableText(value, validLocaleIds)

Whether a value is a translation map: every key a known locale id or the base language of one (en for en-US), every value a string. Deliberately strict, so ordinary config objects with a locale-like key are not misclassified.

Parameters :
Name Optional
value No
validLocaleIds No
Returns : Record<string | string>
mergeTranslatableValues
mergeTranslatableValues<T extends Record>(raw, edited: T, activeLocale: string, defaultLocale: string, validLocaleIds, translatableKeys?)
Type parameters :
  • T extends Record<string, any>

Merge an edited, locale-resolved config object back onto its raw counterpart. Admin UIs edit the resolved view and write the whole object back, which without this would replace a translation map with just the editing admin's language.

For each key whose raw value is a translation map (all of them, unless translatableKeys restricts it): unchanged text keeps the map, a changed text updates only the active locale's entry.

Parameters :
Name Type Optional
raw No
edited T No
activeLocale string No
defaultLocale string No
validLocaleIds No
translatableKeys Yes
Returns : T
pickForLocale
pickForLocale(map: Record, locale: string)

Pick the best non-empty text for locale from a translation map: exact locale id first, then any entry that shares the same language subtag (e.g. active en-GB falling back to a stored en-US).

Parameters :
Name Type Optional
map Record No
locale string No
Returns : string | undefined
resolveTranslatableConfig
resolveTranslatableConfig<T>(config: T, activeLocale: string, defaultLocale: string, validLocaleIds)
Type parameters :
  • T

Deep-clone a config tree, replacing every translation map with its resolved string for the active locale and leaving everything else untouched.

Returns a new structure; the input is not mutated (the raw config must stay intact as the persisted source of truth).

Parameters :
Name Type Optional
config T No
activeLocale string No
defaultLocale string No
validLocaleIds No
Returns : T
resolveTranslatableText
resolveTranslatableText(value, activeLocale: string, defaultLocale: string, validLocaleIds)

Resolve a translatable value to a single string for the active locale.

  • a plain string (or null/undefined) is returned unchanged
  • a translation map is resolved: active locale -> its language subtag -> default locale -> default's subtag -> the first non-empty value present
  • any other (non-map) object is returned unchanged
Parameters :
Name Type Optional
value No
activeLocale string No
defaultLocale string No
validLocaleIds No
Returns : string | undefined

src/main.ts

bootstrap
bootstrap()

src/app/features/change-history/audit-reference-index.ts

buildAuditReferenceIndex
buildAuditReferenceIndex()

A fresh copy of the design document to create in the audit database.

Built per call rather than shared: saveDatabaseIndex stamps aam_version and _rev onto whatever it is given, and a retained _rev from an earlier attempt would make the next one conflict.

src/app/core/common-components/conditions-editor/conditions-combinator.ts

buildConditions
buildConditions(combinator: Combinator, rows)

Assemble the stored condition for a combinator. Incomplete rows are left out.

"all" merges the rows into one object when no field repeats and uses an explicit $and otherwise, because one object cannot hold the same key twice.

Parameters :
Name Type Optional
combinator Combinator No
rows No
Returns : any
normalizeConditions
normalizeConditions(stored: any)

The same condition in the shape the editor would store it.

Parameters :
Name Type Optional
stored any No
Returns : any
parseConditions
parseConditions(stored: any)

Split a stored condition into the combinator it implies and its rows.

An $or only implies "any" once a row in it is filled in, so a section that was seeded with one blank row still gets the default. A condition can also combine $or / $and with sibling keys (Mango's implicit AND, e.g. { status: "active", $or: [...] }). The row editor has no concept of nested groups, so such a sibling key cannot stay ANDed with the array - it becomes one more row, which keeps it visible and editable instead of silently dropping it.

The result never shares objects with stored, because the editor mutates rows in place.

Parameters :
Name Type Optional
stored any No
Returns : ParsedConditions

src/app/core/filter/filters/configurableEnumFilter.ts

buildEnumValueFilter
buildEnumValueFilter<T extends Entity>(name: string, enumValueId: string)
Type parameters :
  • T extends Entity

Match records holding the given enum value, whether stored as a single value or inside an array (multi-select / isArray field).

Always both variants are matched, independent of the field's current isArray setting, because that can be toggled in the admin UI while existing records still hold values in the previous shape (same approach as EntityFilter). A plain equality selector alone does not match array values in CouchDB's Mango _find (unlike client-side, where ucast treats it as "array contains"), so $elemMatch is needed for online-only mode (#4406).

Parameters :
Name Type Optional
name string No
enumValueId string No
Returns : DataFilter<T>

src/app/core/export/export-column-resolvers.ts

buildExportColumnResolvers
buildExportColumnResolvers(schema: Map, entitySchemaService: EntitySchemaService, useFieldIdAsFallbackLabel: unknown)

Build export column resolvers for all fields in a schema.

Iterates the schema, looks up each field's datatype, and collects the columns the datatype contributes via getExportColumns.

Internal fields are excluded, except the record's internal id _id, which users need to relate exported records to each other. It can be selected for an export but is left out of an export that selects no columns, see DownloadService.prepareExportData.

Parameters :
Name Type Optional Default value Description
schema Map No
entitySchemaService EntitySchemaService No
useFieldIdAsFallbackLabel unknown No false

When true, fields without an explicit label use the field id as label (useful for embedded schemas like attendance items).

src/app/features/matching-entities/matching-entities/matching-entities.component.ts

buildMatchingSideConfig
buildMatchingSideConfig(side: MatchingSideConfig, columns, sideIndex: number)

Create a MatchingSideConfig object and fill it with columns from comparison array if necessary

Parameters :
Name Type Optional Description
side MatchingSideConfig No

Base side configuration

columns No

columns array from the overall matching configuration

sideIndex number No

index (0 or 1) of the side in the columns array

Returns : MatchingSideConfig

src/app/core/common-components/entity-form/dynamic-form-validators/permission-condition-validators.ts

buildPermissionConditionValidator
buildPermissionConditionValidator(rules, fieldId: string, toDbFormat, formatValue?)

Create a form validator that checks a single field's value against the permission rule conditions restricting it, so that users see a normal field error instead of only a technical rejection when saving.

The rules are evaluated in the given priority order (as returned by ability.rulesFor): the first rule whose condition matches the value decides, mirroring CASL's own precedence.

Returns null if the field's value cannot be the reason for a denied save. Inverted ("cannot") rules with conditions on several fields and conditions on properties without a form control (e.g. "created.by") are not covered here and remain handled by the save-time permission check.

Parameters :
Name Type Optional Default value Description
rules No

The relevant CASL rules for the action and entity type (ability.rulesFor(...))

fieldId string No

The form field / entity property to validate

toDbFormat No (value) => value

Transformation of the control value into database format, as rule conditions are evaluated against database-format entities

formatValue Yes

Lookup of a human-readable display for a single (database-format) condition value, e.g. resolving enum ids to labels

Returns : ValidatorFn | null
createFieldDecision
createFieldDecision(rule: RuleWithConditions, fieldId: string)
Parameters :
Name Type Optional
rule RuleWithConditions No
fieldId string No
Returns : FieldDecision
describeConditionFragment
describeConditionFragment(fragment: any, formatValue)

Human-readable summary of a single permission condition fragment (the value of one key in a CASL rule's conditions object).

Parameters :
Name Type Optional Default value Description
fragment any No

The condition fragment to describe

formatValue No (value) => String(value)

Lookup of a human-readable display for a single value, e.g. resolving enum ids to labels

Returns : string
describeSingleOperator
describeSingleOperator(fragment, formatValue)

Human-readable display of a fragment holding exactly one operator we have wording for, or undefined if it is not such a fragment.

Parameters :
Name Optional
fragment No
formatValue No
Returns : string | undefined

src/app/core/common-components/entity-form/dynamic-form-validators/readonly-after-set.validator.ts

buildReadonlyValidator
buildReadonlyValidator(entity: Entity)

Validator to ensure a field becomes readonly after it has been saved once.

Parameters :
Name Type Optional
entity Entity No
Returns : { fn: ValidatorFn }

src/app/core/basic-datatypes/date/date-range-filter/date-range-filter-panel/date-range-utils.ts

calculateDateRange
calculateDateRange(dateRangeOption: DateRangeOption)
Parameters :
Name Type Optional
dateRangeOption DateRangeOption No
Returns : DateRange<Date>

src/app/utils/test-utils/vitest-proxy-zone-compat.ts

callbackIndex
callbackIndex(args)
Parameters :
Name Optional
args No
Returns : number | null
enableVitestProxyZoneCompat
enableVitestProxyZoneCompat()
Returns : void
isFunction
isFunction(value)

Wraps Vitest lifecycle and test callbacks in Angular's ProxyZone when it is available.

Angular test utilities such as waitForAsync() and fakeAsync() still rely on Zone context even when the test runner is Vitest. This patch keeps those helpers working without rewriting every existing spec immediately.

Parameters :
Name Optional
value No
Returns : TestFunction
patchCallable
patchCallable(target: Record, key: string)
Parameters :
Name Type Optional
target Record No
key string No
Returns : void
wrapWithProxyZone
wrapWithProxyZone(fn: TestFunction)
Parameters :
Name Type Optional
fn TestFunction No
Returns : TestFunction

src/app/core/logging/error-classification.ts

causeChain
causeChain(error)

The error and the causes it wraps, outermost first (cycle-safe, max 6 levels).

Parameters :
Name Optional
error No
Returns : unknown[]
classifyError
classifyError(error)

What kind of failure the given error is, judged by this one error (not its causes): a typed error, also a copy of one that lost its class. Any other error is not classified: foreign errors are converted where they enter the app.

Parameters :
Name Optional
error No
classifyErrorChain
classifyErrorChain(error, classify)

The classification of the first error in the cause chain that has one, outermost first: a boundary's typed error wins over the raw error it wraps.

Parameters :
Name Optional Default value Description
error No
classify No classifyError

of each error (remote monitoring adds unconverted foreign errors)

isConnectivityError
isConnectivityError(err)

A request that never reached our backend or Keycloak: a ConnectivityError, also when wrapped (as cause). A failed request to another service stays an HttpErrorResponse: check its status (e.g. 0) with failedHttpResponse(). A server error (500) is not a connectivity failure: the server was reached and failed.

Parameters :
Name Optional
err No
Returns : boolean
isNotPermittedError
isNotPermittedError(err)

The permission rules exclude the record or type for the current user: a NotPermittedError, also when wrapped (as cause). Not an expired session or another 401 (e.g. an invalid token signature), which must keep being reported.

Parameters :
Name Optional
err No
Returns : boolean

src/app/features/inherited-field/automated-field-update/automated-field-update-config.service.ts

changesValue
changesValue(update: AffectedEntity)

Whether the update changes the value of the record (not only listed to note that there is no value in common).

Parameters :
Name Type Optional
update AffectedEntity No
Returns : boolean

src/app/core/logging/sentry-grouping.ts

classifyException
classifyException(exception)

The classification of an exception as Sentry serialized it, without the error object.

Parameters :
Name Optional
exception No
errorsOfExceptions
errorsOfExceptions(values, original)

The error objects of the event's exceptions (innermost first, like values), if Sentry's exceptions are their cause chain; else (e.g. an event without the original error) undefined, to judge by the serialized exceptions.

Parameters :
Name Optional
values No
original No
Returns : [] | undefined
fingerprintKey
fingerprintKey(value)

Reduce a message to a grouping key: normalized, and without the casing and punctuation that libraries are inconsistent about ("Unauthorized"/"unauthorized").

Parameters :
Name Optional
value No
Returns : string
groupAsNetworkError
groupAsNetworkError(event, thrown, failedRequest)

Collect every "could not reach the server" into one issue, at level warning: it usually is one device's connection, and an outage shows as this issue rising. The browser-specific wording is replaced by a stable title and kept as a tag.

Parameters :
Name Optional Default value
event No
thrown No
failedRequest No thrown
Returns : Sentry.ErrorEvent
groupByCause
groupByCause(event, hint, classification?: ErrorClassification)
Parameters :
Name Type Optional
event No
hint No
classification ErrorClassification Yes
Returns : Sentry.ErrorEvent
groupByRootCause
groupByRootCause(event, values, chainClassifications, reportedError, rootIndex: number)

Group one failure into one issue.

A wrapped error chain is grouped by its root cause alone (with the component's message as the reported_by tag) only if the root cause is a classified failure that means the same whichever component ran into it: a broken local database, a server fault, a missing permission. All other chains are grouped by the wrapper and the root cause: a generic root cause (e.g. a missing document or a TypeError) in another component is likely a different bug and gets an issue (and new-issue alert) of its own. A network failure is grouped by the wrapper as well, as the wrapper says what could not be done (e.g. AppBootstrapError caused by a failed request).

values are ordered innermost-first: values[0] is the root cause.

Parameters :
Name Type Optional
event No
values No
chainClassifications No
reportedError No
rootIndex number No
Returns : Sentry.ErrorEvent
groupByStatusAndEndpoint
groupByStatusAndEndpoint(event)

A server fault (whoever logged it) gets an issue per status and endpoint: grouped by the root cause alone, a new failing endpoint would otherwise not open an issue of its own. The endpoint is the masked requestPath the boundaries add.

Parameters :
Name Optional
event No
groupingValue
groupingValue(exception, classification)
Parameters :
Name Optional
exception No
classification No
Returns : string
groupSentryEvent
groupSentryEvent(event, hint, classification?: ErrorClassification)

Set a grouping fingerprint (and a matching title) where Sentry's default grouping by stack trace would split one problem into many issues. Summarized in the logging README ("How events are grouped and filtered"); the rules are documented on the functions below.

Parameters :
Name Type Optional Description
event No
hint No
classification ErrorClassification Yes

of the event's error chain (see classifyErrorChain)

Returns : Sentry.ErrorEvent
isUnhandled
isUnhandled(event)

Whether nothing caught the reported error: it reached Angular's ErrorHandler or the window.

Parameters :
Name Optional
event No
Returns : boolean
normalizeErrorValue
normalizeErrorValue(value)

Mask ids, urls and numbers, staying human-readable for titles.

Parameters :
Name Optional
value No
Returns : string
reportNormalized
reportNormalized(event, exception)

Report an exception under its normalized message, which is its grouping key here, keeping the original as extra data (an id per row, or a quoted HTML error page, would otherwise be the issue title).

Parameters :
Name Optional
event No
exception No
rewrappedNamedError
rewrappedNamedError(values, original)

One of our errors that a framework wrapped without adding anything but its stack, e.g. Angular re-throwing an error raised in a resource() loader.

Parameters :
Name Optional
values No
original No
Returns : Sentry.Exception | undefined
rootCauseIndex
rootCauseIndex(errors)

The index of the root cause: the innermost of our typed errors, as the foreign error a boundary converted into it (its cause) only details it; else (also without the error objects) the innermost exception.

Parameters :
Name Optional
errors No
Returns : number
truncateTag
truncateTag(value: string)

Sentry rejects tag values longer than 200 characters.

Parameters :
Name Type Optional
value string No
Returns : string

src/app/utils/typed-http-error.interceptor.ts

classifyHttpError
classifyHttpError(error: HttpErrorResponse)
Parameters :
Name Type Optional
error HttpErrorResponse No
Returns : HttpErrorClassification | undefined
isBackendRequest
isBackendRequest(url: string)
Parameters :
Name Type Optional
url string No
Returns : boolean
toTypedHttpError
toTypedHttpError(error, request: Pick)

The typed error of a failed response of our backend (see typedHttpErrorInterceptor).

Parameters :
Name Type Optional
error No
request Pick No
Returns : unknown
withReadableBody
withReadableBody(error)

The failed response with its body parsed, if it is a Blob (e.g. of a file download): only the body tells an expired session from another 401.

Parameters :
Name Optional
error No
Returns : Promise<unknown>

src/app/core/database/pouchdb/pouchdb-errors.ts

classifyPouchDbError
classifyPouchDbError(error)

The classification of a raw error of PouchDB or IndexedDB by its name and wording (not by its status, see classifyResponseStatus for that):

  • a request to the server that failed or was cut off while reading the response;
  • a write conflict that lost its status (e.g. a replication checkpoint);
  • a broken IndexedDB, unless the error is a programming error.
Parameters :
Name Optional
error No
isDocumentWriteError
isDocumentWriteError(error)

Whether the local database could not store a document itself (e.g. one nested too deeply for IndexedDB), as opposed to a classified failure such as a broken local database ("Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing").

Parameters :
Name Optional
error No
Returns : boolean

src/app/core/logging/uncaught-error-classification.ts

classifyReportedError
classifyReportedError(error)

The classification of an error that remote monitoring reports: by its type (see classifyError), else as one of the few foreign errors that reach it without passing a boundary that would have converted them (see classifyUncaughtError).

Parameters :
Name Optional
error No
classifyUncaughtError
classifyUncaughtError(error)

ONLY for foreign error objects that reach us uncaught (Angular's ErrorHandler, the window's error events) or are logged as they are, without a boundary converting them into a typed error: everything else is judged by its type alone.

  • a failed chunk load, a fetch that failed outside a boundary, or a failed request of another service (status 0, 502-504, e.g. of an HttpErrorResponse);
  • a raw error of PouchDB or IndexedDB that no DatabaseException wraps, e.g. raised in PouchDB's callbacks (see classifyPouchDbError of the database module).

Never for our own errors, and never for a string: a logged message is not classified by its wording (e.g. "Failed to fetch roles" is no failed fetch).

Parameters :
Name Optional
error No
isExpectedFailure
isExpectedFailure(error)

A failure of the user's environment rather than a bug: offline, expired session, missing permission, edit conflict. Judged by the first error along the cause chain that is classified (see classifyReportedError) or named by us: a named error (e.g. AppBootstrapError) says what could not be done, and stays reported.

Parameters :
Name Optional
error No
Returns : boolean

src/app/utils/backend-response.ts

classifyResponseStatus
classifyResponseStatus(status, reasons)

The classification of a failed response of our backend (the database or the API), by its status and the texts the backend gave as reason.

undefined for a status the caller handles itself (e.g. 400, 404) and for a 5xx: whether it is the server failing is for the boundary to judge (PouchDB uses 500 for failures of the local database as well).

Parameters :
Name Optional
status No
reasons No
Returns : Exclude | undefined
errorText
errorText(error)

The text of an error to match wordings against: name: message reason, like Error.toString(), which PouchDB's errors (plain objects) lack.

Parameters :
Name Optional
error No
Returns : string
isFailedFetch
isFailedFetch(error)

Whether the error is the browser's failure of a fetch that got no response.

Parameters :
Name Optional
error No
Returns : boolean
normalizeRequestPath
normalizeRequestPath(url: string)

The path of a request as a grouping key: without host, query and fragment (which may hold personal data), and with every segment that is not a route name masked (document ids, uuids, numbers), e.g. "/db/app/Child%3A1?rev=1-a" → "/db/app/".

Parameters :
Name Type Optional
url string No
Returns : string
textOf
textOf(value)

The value if it is a string (e.g. a property of an error that may be anything), else "".

Parameters :
Name Optional
value No
Returns : string

src/app/core/logging/sentry-event-processing.ts

classifySentryEvent
classifySentryEvent(event, hint)

The classification of the failure an event reports: of its error chain if the error object is known, else by the reported exceptions. Foreign errors that reached the logging unconverted are recognized as well (see uncaught-error-classification.ts). An event of a logged message (or a thrown string) is not classified: a message is not classified by its wording.

Parameters :
Name Optional
event No
hint No
enrichSentryEvent
enrichSentryEvent(event, hint)

Report properties of the error as extra data (e.g. a DatabaseException's status and reason). The cause chain is searched outermost first, as a wrapper naming the failed operation usually has none of these itself.

Parameters :
Name Optional
event No
hint No
isUnhandledErrorInPageScript
isUnhandledErrorInPageScript(event)

An unhandled error raised only by code inlined into the HTML page itself, not by any of our script files: e.g. a script injected by an in-app browser (seen from the iOS Google app). Our own code is always loaded from .js files, so nobody here can act on such an error.

Parameters :
Name Optional
event No
Returns : boolean
processSentryEvent
processSentryEvent(event, hint)

Sentry beforeSend hook: adds structured details, drops events nobody can act on, sets the grouping fingerprint and reports each failure once per page load. See the logging README for the reasoning behind each step.

Parameters :
Name Optional
event No
hint No
Returns : Sentry.ErrorEvent | null

src/app/core/default-values/default-value-service/default-value.service.test-utils.ts

cleanUpTemporarySchemaFields
cleanUpTemporarySchemaFields()

Helper function to remove custom schema fields from Entity that have been created using getDefaultInheritedForm().

getDefaultInheritedForm
getDefaultInheritedForm(additionalSchemaConfig)

Helper function to add some custom schema fields to Entity for testing. Use in combination with a call to cleanUpTemporarySchemaFields() in afterEach.

Parameters :
Name Optional Default value
additionalSchemaConfig No {}
Returns : EntityForm<any>
testDefaultValueCase
testDefaultValueCase(service: DefaultValueService, fieldSchema: EntitySchemaField, expected: any)
Parameters :
Name Type Optional
service DefaultValueService No
fieldSchema EntitySchemaField No
expected any No

src/bootstrap-reset.ts

clearLastSyncMarkers
clearLastSyncMarkers()

Remove the "last sync" marker of every database, so that no previous sync is assumed to have happened on this device.

This accesses the real localStorage directly rather than the injectable LOCAL_STORAGE_TOKEN, because it also runs before Angular exists. Callers that need this mockable should wrap it in an instance method first.

runPendingReset
runPendingReset()

Run pending reset cleanup before Angular bootstraps. Called from main.ts so that IndexedDB databases are deleted while no PouchDB connections are open (eliminating race conditions).

Returns : Promise<void>
showCloseOtherTabsNotice
showCloseOtherTabsNotice()

Ask the user on the static loading screen (index.html) to close other tabs, because they block the reset (and therefore the app start) until closed.

The text is English only, like the rest of the loading screen: translations are not loaded yet at this point of the bootstrap. Angular replaces the loading screen (incl. this notice) once the app starts.

src/app/features/notification/close-only-submenu.ts

closeOnlySubmenu
closeOnlySubmenu(menu: MatMenuTrigger, event: MouseEvent)

Close the mat-menu of the given menu trigger and stop propagation of the event to avoid closing parent menus as well.

Parameters :
Name Type Optional
menu MatMenuTrigger No
event MouseEvent No

src/app/features/reporting/report-config.ts

collectQueryStrings
collectQueryStrings(node)

Recursively collect every query string value from a report definition tree.

Parameters :
Name Optional
node No
Returns : string[]
isHierarchicalReport
isHierarchicalReport(report)

Whether a report's results should be rendered as a hierarchical group/count table (sql-v2-table) rather than a flat tabular table (object-table).

Derived from the config structure: a report is hierarchical when its reportDefinition contains a group (groupTitle) or more than one top-level item; otherwise it is tabular.

Parameters :
Name Optional
report No
Returns : boolean
reportUsesDateRange
reportUsesDateRange(report)

Whether running this report offers a date-range (start & end date) input, derived from the date placeholders used in its queries so it stays in sync with the actual report definition:

  • "sql": the query uses the $startDate / $endDate placeholders.
  • "reporting"/"exporting": the in-browser query uses positional ? placeholders (date args).
Parameters :
Name Optional
report No
Returns : boolean

src/app/core/filter/filters/filters.ts

combineFilterConditions
combineFilterConditions<T>(...conditions: undefined)
Type parameters :
  • T

Combine the given conditions so that all of them have to be met.

Conditions without any content are left out, because an empty object as an $and branch makes a database query match no document at all, and $and is dropped entirely when it is not needed. Use this instead of merging conditions into one object, which would silently overwrite a key (like $or) that more than one of them uses.

Parameters :
Name Optional
conditions No
Returns : DataFilter<T>
createEmptyValueFilter
createEmptyValueFilter<T extends Entity>(fieldName: string, includeNestedId: unknown, includeEmptyArray: unknown)
Type parameters :
  • T extends Entity
Parameters :
Name Type Optional Default value
fieldName string No
includeNestedId unknown No false
includeEmptyArray unknown No false
Returns : DataFilter<T>
getCurrentRecordPlaceholderFields
getCurrentRecordPlaceholderFields(condition)

The ids of the fields of the current record that the $current_record.<fieldId> placeholders in a condition refer to (the link field, if a placeholder refers to a field of a linked record).

Parameters :
Name Optional
condition No
Returns : string[]
getCurrentRecordReferences
getCurrentRecordReferences(condition)

what the $current_record.<fieldId> placeholders in a condition refer to

Parameters :
Name Optional
condition No
isCurrentRecordPlaceholder
isCurrentRecordPlaceholder(value)
Parameters :
Name Optional
value No
Returns : string
parseCurrentRecordPlaceholder
parseCurrentRecordPlaceholder(placeholder: string)

what a $current_record.<fieldId> placeholder refers to, with its path split at the first "."

Parameters :
Name Type Optional
placeholder string No
placeholderFieldId
placeholderFieldId(placeholder: string)

What a $current_record.<fieldId> placeholder refers to (without the prefix): the id of a field of the current record, or a path through a link field to a field of the linked record(s), e.g. parentAction.locations.

Parameters :
Name Type Optional
placeholder string No
Returns : string

src/app/core/common-components/entity-form/unique-property-validator/unique-property-validator.ts

comparableValue
comparableValue(value, shouldNormalize: boolean)

A multi-lingual text is a per-language map, which no two maps compare equal as. Compare the text of the active language instead, i.e. what the admin actually sees. Anything that is not such a map is returned unchanged.

Parameters :
Name Type Optional
value No
shouldNormalize boolean No
Returns : unknown
isDuplicate
isDuplicate(currentValue, existingValues, shouldNormalize: boolean)
Parameters :
Name Type Optional
currentValue No
existingValues No
shouldNormalize boolean No
Returns : boolean
normalizeValue
normalizeValue(value)
Parameters :
Name Optional
value No
Returns : unknown
uniquePropertyValidator
uniquePropertyValidator(config: UniquePropertyValidatorConfig)

Generic validator to ensure a property value is unique within a collection. Can be configured to validate different properties (id, label, etc.) with optional normalization.

Parameters :
Name Type Optional Description
config UniquePropertyValidatorConfig No

Configuration object for the validator

An async validator function

src/app/utils/filter-compare-utils.ts

compareDates
compareDates(a: Date, b: string)

Compare dates at day precision

Parameters :
Name Type Optional
a Date No
b string No
Returns : "1" | unknown | "0"
extendedCompare
extendedCompare<T>(a: T, b: T)
Type parameters :
  • T

Handles special cases like ConfigurableEnum objects and Dates. Used for filter evaluation and conditional color matching.

This utility is kept separate to avoid circular dependencies between Entity and FilterService.

Parameters :
Name Type Optional
a T No
b T No
Returns : "1" | unknown | "0"

-1 if a < b, 0 if a === b, 1 if a > b

src/app/core/common-components/entities-table/table-sort/table-sort.ts

compareValues
compareValues(a: unknown, b: unknown)
Parameters :
Name Type Optional
a unknown No
b unknown No
getComparableValue
getComparableValue<OBJECT, PROPERTY extends keyof OBJECT>(obj: OBJECT, key: PROPERTY, sortValueFns?: SortValueFns)
Type parameters :
  • OBJECT
  • PROPERTY extends keyof OBJECT
Parameters :
Name Type Optional
obj OBJECT No
key PROPERTY No
sortValueFns SortValueFns Yes
Returns : number | string | Symbol
tableSort
tableSort<OBJECT extends Entity, PROPERTY extends keyof OBJECT>(data, __namedParameters: {direction: "asc" | "desc" | string, active: PROPERTY | string, sortValueFns: SortValueFns<OBJECT>})
Type parameters :
  • OBJECT extends Entity
  • PROPERTY extends keyof OBJECT

Custom sort implementation for a MatTableDataSource of entities

Parameters :
Name Type Optional Description
data No

The data of the data source

direction "asc" | "desc" | string No

direction "asc", "desc" or "" meaning none

active PROPERTY | string No

the property of T for which it should be sorted

sortValueFns SortValueFns<OBJECT> No
Returns : OBJECT[]

the sorted records

src/app/core/database/db-name-helpers.ts

computeDbNames
computeDbNames(session: SessionInfo)

Compute new-format database names (using Keycloak UUID + dash separator). Used after migration to the "indexeddb" adapter.

Parameters :
Name Type Optional
session SessionInfo No
Returns : { app: string; notifications: string }
computeLegacyDbNames
computeLegacyDbNames(session: SessionInfo)

Compute legacy-format database names (username for app, underscore for notifications). Used with the old "idb" adapter before migration.

Parameters :
Name Type Optional
session SessionInfo No
Returns : { app: string; notifications: string }

src/app/core/language/active-locale.ts

configureActiveLocale
configureActiveLocale(locale: string, locales)

Called once during app startup by LanguageModule.

Parameters :
Name Type Optional
locale string No
locales No
Returns : void
getActiveLocale
getActiveLocale()

The id of the active locale, e.g. to store a text edited in the active language.

Returns : string
isLocaleTranslationMap
isLocaleTranslationMap(value)

Whether the value is a per-language map of one of the available locales.

Parameters :
Name Optional
value No
Returns : Record<string | string>
mergeLocaleTranslations
mergeLocaleTranslations<T extends Record>(raw, edited: T, translatableKeys?)
Type parameters :
  • T extends Record<string, any>

mergeTranslatableValues for the active locale.

Parameters :
Name Type Optional
raw No
edited T No
translatableKeys Yes
Returns : T
resolveLocaleConfig
resolveLocaleConfig<T>(value: T)
Type parameters :
  • T

Deep-resolve, returning a new structure so the input stays raw.

Parameters :
Name Type Optional
value T No
Returns : T
resolveLocaleText
resolveLocaleText(value)

A configured text in the active language. Values that are not translation maps are returned unchanged.

Parameters :
Name Optional
value No
Returns : string | undefined
resolveLocaleText
resolveLocaleText<T>(value: T)
Type parameters :
  • T
Parameters :
Name Type Optional
value T No
Returns : T
resolveLocaleText
resolveLocaleText(value)
Parameters :
Name Optional
value No
Returns : unknown

src/app/core/common-components/entities-table/data-source/paginated-data-source.ts

convertToCouchRegex
convertToCouchRegex(node: any)

Recursively converts any $regex value in an object to a CouchDB inline (?i) pattern.

Parameters :
Name Type Optional Description
node any No
  • The query object or value to transform.
Returns : any

The transformed query object.

isOperatorObject
isOperatorObject(condition)
Parameters :
Name Optional
condition No
Returns : object
toDbDateBound
toDbDateBound(operator: string, value, dataType)

Date filters compare with a day ("YYYY-MM-DD"), which records in memory match at day precision. For a field stored in another format, rewrite the day into that format, keeping this meaning: a "date" is a UTC timestamp, so the day becomes its first or last moment in local time; a "month" is "YYYY-MM" and counts as its first day.

Parameters :
Name Type Optional
operator string No
value No
dataType No
Returns : unknown

src/app/core/basic-datatypes/date/date.static.ts

convertToMomentFormat
convertToMomentFormat(angularFormat: string)

Converts an Angular DatePipe format string to the equivalent Moment.js format string. Angular uses lowercase tokens (dd, yyyy), Moment.js uses uppercase (DD, YYYY). Exported for testing only.

Parameters :
Name Type Optional
angularFormat string No
Returns : string
setGlobalDateFormat
setGlobalDateFormat(format: string)

Set the global date format at runtime based on configuration. This is called by SiteSettingsService during initialization.

Parameters :
Name Type Optional Description
format string No

Angular DatePipe format string (e.g., "dd.MM.yyyy", "MM/dd/yyyy")

Returns : void

src/app/features/location/map-utils.ts

createColoredDivIcon
createColoredDivIcon(color: string)

Creates a custom colored marker icon using Leaflet's DivIcon. This approach ensures accurate color representation for all colors, overcoming the limitations of the hue-rotate filter which cannot properly handle achromatic colors or accurately represent all RGB values.

Based on: https://stackoverflow.com/a/40870439/1473411

Parameters :
Name Type Optional Description
color string No

Hex or RGB color string for the marker

Returns : L.DivIcon

Leaflet DivIcon with the specified color

getKmDistance
getKmDistance(x: Coordinates, y: Coordinates)

Calculate distance between two points Source ://henry-rossiter.medium.com/calculating-distance-between-geographic-coordinates-with-javascript-5f3097b61898https

Parameters :
Name Type Optional
x Coordinates No
y Coordinates No
getLocationProperties
getLocationProperties(entity: EntityConstructor)

Get all properties of an entity that represent a geographic location

Parameters :
Name Type Optional
entity EntityConstructor No
getMinDistanceKm
getMinDistanceKm(entity: Entity, coordinatesProperties, compareCoordinates)

Calculate the minimum distance (km) between an entity's location fields and a list of comparison coordinates. Returns null if no distance can be computed.

Parameters :
Name Type Optional
entity Entity No
coordinatesProperties No
compareCoordinates No
Returns : number | null

src/app/core/common-components/entity-form/current-record-state.ts

createCurrentRecordState
createCurrentRecordState<T extends Entity>(entity: T, form: FormGroup)
Type parameters :
  • T extends Entity

Copy of the record with the current, possibly unsaved values of its form applied (including disabled and hidden fields).

Parameters :
Name Type Optional
entity T No
form FormGroup No
Returns : T
currentRecordSignal
currentRecordSignal<T extends Entity = Entity>(follow)
Type parameters :
  • T extends Entity = Entity

The current state of the record a field belongs to (see CurrentRecordContext), followed only while follow() is true, otherwise undefined. Must be called in an injection context (e.g. as a field initializer of a component).

Parameters :
Name Optional
follow No
Returns : Signal<T | undefined>
getCurrentRecordOfControl
getCurrentRecordOfControl<T extends Entity>(control: AbstractControl, record)
Type parameters :
  • T extends Entity

The record with the current values of the form the given control belongs to (for validators, which only get their control), or the record itself if the control is not part of a form.

Validators build this themselves instead of reading EntityForm.currentRecord: they run before the form notifies of the change that triggered them.

Parameters :
Name Type Optional
control AbstractControl No
record No
Returns : T | undefined

src/app/core/basic-datatypes/date/date-limit.ts

createDateComparisonValidator
createDateComparisonValidator(dateParamValue, comparator, errorKey: string, paramName)

Creates a date range validator (min or max).

Parameters :
Name Type Optional
dateParamValue No
comparator No
errorKey string No
paramName No
Returns : ValidatorFn
descriptionForDateValidator
descriptionForDateValidator(validator, validationValue: any)
Parameters :
Name Type Optional
validator No
validationValue any No
Returns : string
formatDateAsDayMonthYear
formatDateAsDayMonthYear(value: Date)
Parameters :
Name Type Optional
value Date No
Returns : string
maxDateValidator
maxDateValidator(maxDateValue)

Validator for maximum date.

Parameters :
Name Optional
maxDateValue No
Returns : ValidatorFn
minDateValidator
minDateValidator(minDateValue)

Validator for minimum date.

Parameters :
Name Optional
minDateValue No
Returns : ValidatorFn
normalizeDateOnly
normalizeDateOnly(value: Date)

Normalizes a date to just the date portion (no time).

Parameters :
Name Type Optional
value Date No
Returns : Date
parseToDate
parseToDate(value)

Parses a value to a Date object. Handles Date objects, date strings (YYYY-MM-DD), timestamps, and special value "$now".

Parameters :
Name Optional
value No
Returns : Date | undefined

src/app/core/entity/model/embedded-entity.ts

createEmbeddedEntity
createEmbeddedEntity(schema: EntitySchema, context: EmbeddedEntityContext, entry?: Record)

Wrap an entry of an embedded field as EmbeddedEntity, to edit it like a record.

Parameters :
Name Type Optional Description
schema EntitySchema No

the inner fields of the entry (see getEmbeddedSchema)

context EmbeddedEntityContext No

where the entry belongs

entry Record Yes

the current values of the entry (not changed); none for a new entry

Returns : EmbeddedEntity
getSavedRecord
getSavedRecord(entity: Entity)

The record that is actually saved for the given entity: the record holding it, if it is an EmbeddedEntity, otherwise the entity itself.

Parameters :
Name Type Optional
entity Entity No
Returns : Entity

src/app/core/entity/entity-mapper/mock-entity-mapper-service.ts

createEntityMapperSpyObj
createEntityMapperSpyObj()
mockEntityMapperProvider
mockEntityMapperProvider(withData, customDatabaseResolverService)
Parameters :
Name Optional Default value
withData No []
customDatabaseResolverService No { resetSync: () => Promise.resolve(), isIndexedDbAdapterSupported: () => false, getDatabase: () => ({ purge: () => Promise.resolve(false) }), }
Returns : Provider[]

src/app/core/demo-data/create-entity-of-type.ts

createEntityOfType
createEntityOfType(type: string, id: string)

"Simulate" a custom entity type that saves all fields without transformations through a mocked EntitySchema.

This is a utility function to help demo data creation because the dynamically migrated config is not ready at the time of demo data generation yet.

Parameters :
Name Type Optional Default value
type string No
id string No uuid()
Returns : Entity & { }

src/app/utils/test-utils/fake-storage.ts

createFakeStorage
createFakeStorage(initial: Record)

An in-memory stand-in for localStorage, to be provided for LOCAL_STORAGE_TOKEN in tests.

Prefer this over vi.spyOn(Storage.prototype, ...): Storage.prototype lives in the worker process rather than the module registry, so Vitest's isolate does not undo such a stub. An unrestored one leaks into every later spec file and silently makes unrelated tests read a fake localStorage.

Parameters :
Name Type Optional Default value
initial Record No {}
Returns : Storage

src/app/features/skill/skill-api/skill-api-mock.ts

createSkillApiDummyData
createSkillApiDummyData(externalId: string)
Parameters :
Name Type Optional
externalId string No
Returns : ExternalProfile

src/app/core/common-components/confirmation-dialog/confirmation-dialog/confirmation-dialog.component.ts

CustomYesNoButtons
CustomYesNoButtons(yesLabel: string, noLabel: string)
Parameters :
Name Type Optional
yesLabel string No
noLabel string No

src/app/core/entity/database-entity.decorator.ts

DatabaseEntity
DatabaseEntity(entityType: string)

Decorator (Annotation @DatabaseEntity()) to set the string ENTITY_TYPE to an Entity Type. The entity should also be added to the databaseEntities array of the surrounding module.

also see

Parameters :
Name Type Optional Description
entityType string No

The string key for this Entity Type, used as id prefix.

src/app/core/database/pouchdb/database-exception.ts

databaseError
databaseError(error, entityId?: string)

Where errors of the (local or remote) PouchDB enter the app: the error to throw for one. A classified failure is converted into its typed error (see toTypedDatabaseError), as is a typed error thrown by our own code underneath (e.g. a ServerError of the remote database's fetch) passed on; any other error becomes a DatabaseException.

Parameters :
Name Type Optional Description
error No
entityId string Yes

the document (or query) concerned, reported as extra data

Returns : Error
toTypedDatabaseError
toTypedDatabaseError(error, entityId?: string)

The typed error (see DATABASE_ERRORS) for an error of PouchDB or of the IndexedDB underneath it, keeping the raw error as its cause and its status:

  • by its status and the reason the server gave (no response or a gateway status, 401 expired / not permitted, 403, 409), the same mapping as the HTTP interceptor's (classifyResponseStatus);
  • a typed error of ours that PouchDB's replication copied, losing its class (recognized by its name): re-created, with the copy as cause;
  • else by the name and wording of PouchDB's and IndexedDB's errors (classifyPouchDbError): a broken IndexedDB, an aborted request, a conflict.

Any other error is returned unchanged (e.g. a 404 missing), as is one of our errors (e.g. a ConnectivityError of the remote database's fetch).

Parameters :
Name Type Optional
error No
entityId string Yes
Returns : unknown

src/app/utils/test-utils/deferred.ts

deferred
deferred<T>()
Type parameters :
  • T

A promise that a test settles itself, to control exactly when a mocked async step finishes.

src/app/core/logging/report-once.ts

describe
describe(event)

The event's title, as Sentry would show it.

Parameters :
Name Optional
event No
Returns : string
isAlreadyReported
isAlreadyReported(event, original)

Whether the error was already part of an event: e.g. logged by a component (wrapped in its message) and then re-thrown to Angular's ErrorHandler.

Only an unhandled error is dropped for its root cause alone: two components logging the same failure are both reported (grouped into one issue, with their messages as reported_by tag).

Parameters :
Name Optional
event No
original No
Returns : boolean
isExcessiveRepeat
isExcessiveRepeat(event, classification)
Parameters :
Name Optional
event No
classification No
Returns : boolean
repeatKey
repeatKey(event)

The issue an event ends up in, as far as known here: its fingerprint, or for stack-grouped errors the thrown error (without the stack, so that an error loop is capped even where its frames differ).

Parameters :
Name Optional
event No
Returns : string
repeatLimit
repeatLimit(event, classification)

What counts as a repeat of the event, and how often that is reported.

Parameters :
Name Optional
event No
classification No
Returns : unknown
reportOnce
reportOnce(event, hint, classification)

The event, or null if it repeats a failure already reported in this page load (then it is kept as a breadcrumb instead).

Parameters :
Name Optional
event No
hint No
classification No
Returns : Sentry.ErrorEvent | null
resetReportedEvents
resetReportedEvents()

For tests: start a new page load.

src/app/core/entity-details/embedded-array-data/embedded-array-data.component.ts

describeInvalidEntries
describeInvalidEntries(control: AbstractControl)

The validation errors of the whole property (e.g. "required"), as a message for the user.

Parameters :
Name Type Optional
control AbstractControl No
Returns : string

src/app/core/logging/http-response-logging.ts

describeResponse
describeResponse(response, method?: string)

The diagnostic fields of a fetch Response as a plain object: a Response itself is logged as {}. The request method tells a rejected write from a read.

Parameters :
Name Type Optional
response No
method string Yes
Returns : { method?: string; status?: number; statusText?: string; responseUrl?: string }

src/app/core/import/import.service.ts

describeSaveFailure
describeSaveFailure(error)

A short description of why a save failed, safe to pass on to a log or a message.

A rejected save reports what happened to each individual document (see Database.putAll), i.e. potentially thousands of document ids - which have no place in remote monitoring (see #4174) or in a message shown to the user.

Parameters :
Name Optional
error No
Returns : unknown

src/app/core/language/language.service.ts

describeValue
describeValue(value)

A readable description of a value for logs, instead of "[Object]"

Parameters :
Name Optional
value No
Returns : string

src/app/core/basic-datatypes/configurable-enum/configurable-enum.ts

displayLabel
displayLabel(label)
Parameters :
Name Optional
label No
Returns : string

src/app/core/admin/admin-entity-details/admin-entity-form/admin-entity-form.component.ts

dropEmptyFields
dropEmptyFields(groups)

Remove empty (null / undefined) entries from the groups' field lists.

These are not a valid ColumnConfig and only ever come from a malformed config, but every consumer dereferences them (toFormFieldConfig(field).id) and would throw on the whole editor. Dropping them here keeps the rest of the configuration editable so the admin can repair it.

Parameters :
Name Optional
groups No
Returns : FieldGroup[]
moveFieldBetweenGroups
moveFieldBetweenGroups(groups, field: ColumnConfig, from: FieldDropTarget, fromIndex: number, to: FieldDropTarget, toIndex: number)

Move field from one drop target to another, returning new group objects for the groups that changed (all others are kept as they are).

A target of "available" is the toolbar of fields not used in the form: it holds no state of its own (it is derived from the form's groups), so a field moved there is simply removed from the form and a field moved from there is simply added.

Parameters :
Name Type Optional
groups No
field ColumnConfig No
from FieldDropTarget No
fromIndex number No
to FieldDropTarget No
toIndex number No
Returns : FieldGroup[]

src/app/core/basic-datatypes/string/email.datatype.ts

emailValidatorWithMessage
emailValidatorWithMessage(control: AbstractControl)

Validator for the value of the field: a valid email address (or no value).

Parameters :
Name Type Optional
control AbstractControl No
Returns : ValidationErrors | null

src/app/core/basic-datatypes/date-range/date-range.datatype.ts

endNotBeforeStart
endNotBeforeStart(control: AbstractControl)

Validator for the value of the field: the end must not be before the start.

Parameters :
Name Type Optional
control AbstractControl No
Returns : ValidationErrors | null

src/app/core/logging/logging.service.ts

enhanceSentryBreadcrumb
enhanceSentryBreadcrumb(breadcrumb, hint: SentryBreadcrumbHint)

Add more human-readable descriptions to Sentry breadcrumbs for debugging.

see https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/

Parameters :
Name Type Optional
breadcrumb No
hint SentryBreadcrumbHint No
loggedError
loggedError(message, context)

The error a log call is about: the message if it is an error, else the first error among the context (also an error-like object, e.g. an HttpErrorResponse).

Parameters :
Name Optional
message No
context No
Returns : unknown
messageText
messageText(message: any)

The text of anything that was passed to the logger as its "message".

Parameters :
Name Type Optional
message any No
Returns : string
toReportedError
toReportedError(message: any, context, logLevel: LogLevel)

The Error to report for a log call, or undefined for a plain message event.

A logged message comes with the logged error as its cause (a LoggedError), also for a warning: only as an exception is the error grouped by its cause. A warning without an error is about the situation itself.

Parameters :
Name Type Optional Default value
message any No
context No
logLevel LogLevel No LogLevel.ERROR
Returns : Error | undefined

src/app/features/location/geo-location.ts

enrichGeoLocation
enrichGeoLocation(location)
Parameters :
Name Optional
location No
getCityFromAddress
getCityFromAddress(address)

The most specific place name available for an address.

Parameters :
Name Optional
address No
Returns : string | undefined

src/app/features/change-history/display-audit-user/display-audit-user.component.ts

ensureValidEntityId
ensureValidEntityId(author: string)

The given author as an entity id, or undefined when it is not one. An entity id is type-prefixed, which a plain username is not.

Parameters :
Name Type Optional
author string No
Returns : string | undefined

src/app/core/filter/filter-generator/filter-predicate.ts

entityFilterPredicate
entityFilterPredicate(data: Entity, filter: string)
Parameters :
Name Type Optional
data Entity No
filter string No
Returns : boolean

src/app/core/user/user-admin-service/user-account-action-guard.service.ts

entityIdsMatch
entityIdsMatch(entityIdA?, entityIdB?)

Compares two entity ids where one or both may be missing the Type: prefix (e.g. a legacy exact_username stored without it), treating them as equal when they refer to the same record.

Exported for reuse wherever a stored/session entity id needs to be compared against a value coming from an entity picker (which always includes the prefix).

Parameters :
Name Optional
entityIdA Yes
entityIdB Yes
Returns : boolean
getEntityIdWithoutTypePrefix
getEntityIdWithoutTypePrefix(entityId: string)
Parameters :
Name Type Optional
entityId string No
Returns : string

src/app/core/entity/schema/entity-field-reference-label.ts

entityToFieldReferenceLabel
entityToFieldReferenceLabel(entityLabel: string, fieldLabel: string)

School Enrollments > field "Linked School"

Parameters :
Name Type Optional
entityLabel string No
fieldLabel string No
Returns : string
fieldReferenceLabel
fieldReferenceLabel(fieldLabel: string)

field "Linked School"

Parameters :
Name Type Optional
fieldLabel string No
Returns : string
fieldToEntityReferenceLabel
fieldToEntityReferenceLabel(fieldLabel: string, entityLabel: string)

field "Linked School" > School

Parameters :
Name Type Optional
fieldLabel string No
entityLabel string No
Returns : string

src/app/features/api-client/api-client.service.ts

errorMessageOf
errorMessageOf(err)

The message for the user of a failed request to the api-client module of the backend.

Parameters :
Name Optional
err No
Returns : string
logRequestError
logRequestError(message: string, err)

Log a failed request to the api-client module of the backend. Expected failures (4xx, e.g. a duplicate client id, or no connection) are only logged as debug, so that they are not reported to the error monitoring; server errors (5xx) are logged as warning.

Parameters :
Name Type Optional
message string No
err No

src/app/core/database/pouchdb/pouchdb-corruption-recovery.service.ts

errorToText
errorToText(error)

The whole error serialized, not only its name, message and reason (as errorText of backend-response.ts): the IndexedDB failure may be in nested properties, e.g. in the result array of a bulkDocs.

Parameters :
Name Optional
error No
Returns : string
isKnownMultiTabDatabaseCorruption
isKnownMultiTabDatabaseCorruption(error)

Detect IndexedDB/PouchDB corruption symptoms commonly observed when the app is used in multiple tabs with concurrent writes.

Only signals specific to this corruption are matched, as it leads to offering a reset of the local data: a "transaction was aborted" or an unknown_error also follows other failures, e.g. a document too deeply nested to store. For those, the database itself is checked (see hasOutdatedSequenceCounter).

Parameters :
Name Optional
error No
Returns : boolean

src/app/core/common-components/entity-form/entity-form.service.ts

escapeMarkdown
escapeMarkdown(text: string)

so that markdown shows the text as it is (e.g. a record name in angle brackets, which would be read as HTML)

Parameters :
Name Type Optional
text string No
Returns : string
getWarnings
getWarnings<T extends Entity>(entityForm: EntityForm)
Type parameters :
  • T extends Entity

The form's errors as "field label: message" (in markdown), if all of them are warnings (marked with warning: true).

Parameters :
Name Type Optional
entityForm EntityForm No
Returns : [] | undefined
hasOnlyWarnings
hasOnlyWarnings(form: FormGroup)

whether all errors of the form are warnings (marked with warning: true), which saving only asks to confirm

Parameters :
Name Type Optional
form FormGroup No
Returns : boolean

src/app/core/filter/filters/stringFilter.ts

escapeRegExp
escapeRegExp(text: string)

Escape all special regex characters so the given text can be used as a literal search string inside a regular expression.

Parameters :
Name Type Optional
text string No
Returns : string

src/app/core/logging/logging-test-utils.ts

eventFor
eventFor(error: Error, options)

The event Sentry builds for an error: its cause chain innermost-first.

Parameters :
Name Type Optional Default value
error Error No
options No {}
Returns : Sentry.ErrorEvent
processError
processError(error: Error, options?)
Parameters :
Name Type Optional
error Error No
options Yes
setUpPageLoad
setUpPageLoad()

Start each test with a new page load, online.

title
title(event)

How Sentry titles an event: by its thrown error.

Parameters :
Name Optional
event No
Returns : string

src/app/utils/test-utils/array-test-utils.ts

expectArrayWithExactContents
expectArrayWithExactContents(actual, expected)

Assert that two arrays contain the same items, regardless of order, while still supporting asymmetric matchers such as expect.objectContaining(...).

Parameters :
Name Optional
actual No
expected No
Returns : void
matches
matches(actual, expected)
Parameters :
Name Optional
actual No
expected No
Returns : boolean

src/app/core/admin/admin-role-permissions/permission-matrix.ts

extractExtra
extractExtra(rule: DatabaseRule)

properties of a rule beyond subject/action/conditions (e.g. reason), or undefined if none

Parameters :
Name Type Optional
rule DatabaseRule No
fragmentToRule
fragmentToRule(fragment: RuleFragment)
Parameters :
Name Type Optional
fragment RuleFragment No
Returns : DatabaseRule
groupAllowedActions
groupAllowedActions(row: MatrixRow)

group a row's allowed actions by identical conditions + extra properties

Parameters :
Name Type Optional
row MatrixRow No
isSupported
isSupported(rule: DatabaseRule)
Parameters :
Name Type Optional
rule DatabaseRule No
Returns : boolean
matrixToRules
matrixToRules(model: MatrixModel)
Parameters :
Name Type Optional
model MatrixModel No
Returns : DatabaseRule[]
rulesToMatrix
rulesToMatrix(rules)

Convert permission rules into the matrix model. Rules for the same subject are merged, with later rules winning per action.

Parameters :
Name Optional
rules No
Returns : MatrixModel

src/app/features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard/entity-count-dashboard.component.ts

extractGroupId
extractGroupId(group: any)

Extract a group ID from a group value (string, object, etc.)

Parameters :
Name Type Optional
group any No
Returns : string
extractHumanReadableLabel
extractHumanReadableLabel(value)

Get a human-readable string from the given value as a label.

Parameters :
Name Optional
value No
Returns : string | undefined

src/app/core/database/pouchdb/version-comparison.utils.ts

extractNumericParts
extractNumericParts(version: string)
Parameters :
Name Type Optional
version string No
Returns : number[]
isVersionNewer
isVersionNewer(leftVersion: string, rightVersion: string)

Returns true when leftVersion is newer than rightVersion.

The comparison is based on numeric segments to avoid lexicographic issues, e.g. 9.0.0 < 10.0.0.

Parameters :
Name Type Optional
leftVersion string No
rightVersion string No
Returns : boolean

src/app/features/attendance/model/participant-id-extractor.ts

extractParticipantIds
extractParticipantIds(value)

Normalize participant sources into plain participant IDs.

Supports both configured participants field shapes used in attendance:

  • string[] with direct entity IDs (datatype entity)
  • attendance-like entries containing a participant ID (datatype attendance)
Parameters :
Name Optional
value No
Returns : string[]

src/app/utils/failed-http-response.ts

failedHttpResponse
failedHttpResponse(error)

The failed response of an HttpClient request, to read its status or body.

Failures of requests to our backend (/db, /api) may arrive as a typed error (e.g. a ServerError) instead of the HttpErrorResponse, which is then its cause (see typedHttpErrorInterceptor). This finds the response in either case, so use it instead of instanceof HttpErrorResponse.

Parameters :
Name Optional
error No
Returns : HttpErrorResponse | undefined

src/app/core/database/pouchdb/remote-pouch-database.ts

failedResponseError
failedResponseError(result, method: string, remoteUrl: string, fetchError?)

The error for a request that got no usable response: a ConnectivityError if it never reached CouchDB (no response, or a gateway status of the proxy in front of it), else a ServerError carrying the status - a server that fails is a fault to fix, not a dropped connection.

Parameters :
Name Type Optional
result No
method string No
remoteUrl string No
fetchError Yes
Returns : Promise<ConnectivityError | ServerError>
requestMethod
requestMethod(opts)

The HTTP method of a fetch request, defaulting the way fetch itself does.

Parameters :
Name Optional
opts No
Returns : string
revisionNumber
revisionNumber(rev)

The generation number of a CouchDB revision (the 3 of 3-abc...), which increases with every write to a document. NaN if it cannot be read, so callers fall back to emitting rather than suppressing a document they cannot place in order.

Parameters :
Name Optional
rev No
Returns : number

src/app/core/common-components/conditions-editor/conditions-editor.component.ts

fieldOptions
fieldOptions(fields)

the options for the given fields that an admin can select (not the internal ones)

Parameters :
Name Optional
fields No
Returns : FormFieldConfig[]
linkedFieldOptions
linkedFieldOptions(__namedParameters: {linkId: LinkedTypeFields, link: unknown, fields: unknown})

the options for the fields of the records linked in a link field ("link field › field")

Parameters :
Name Type Optional
linkId LinkedTypeFields No
link unknown No
fields unknown No
Returns : FormFieldConfig[]

src/app/core/basic-datatypes/date-range/parent-ranges.ts

findParentOutside
findParentOutside(range, parents)

name of the first parent whose range the given range goes beyond

Parameters :
Name Optional
range No
parents No
Returns : string | undefined
getParentIds
getParentIds(config: WithinParentConfig, record)

The ids of the parent records to compare a record's range with. None for an anonymized record, whose dates are reduced to the year.

Parameters :
Name Type Optional Description
config WithinParentConfig No
record No

the record, with the current values of its form while it is edited (see createCurrentRecordState), so that a changed link is followed before it is saved

Returns : string[]
loadParentRanges
loadParentRanges(entityMapper: EntityMapperService, parentIds, valueField: string)

Loads the ranges of the given parent records (except anonymized ones, whose dates are reduced to the year, and the ones that cannot be loaded).

Parameters :
Name Type Optional
entityMapper EntityMapperService No
parentIds No
valueField string No
parentRangesResource
parentRangesResource(params)

Loads the ranges of the parent records that a record links to (see getParentIds and loadParentRanges). Must be called in an injection context (e.g. as a field initializer of a component).

Parameters :
Name Optional Description
params No

the record (with the current values of its form while it is edited), the id and the withinParent config of its field (without a config nothing is loaded)

src/app/utils/flat-tree/flat-tree.ts

flattenTree
flattenTree<T>(nodes, adapter: FlatTreeAdapter, level: number)
Type parameters :
  • T

Flatten a nested tree into rows (pre-order), carrying the depth as level.

Parameters :
Name Type Optional Default value
nodes No
adapter FlatTreeAdapter No
level number No 0
Returns : FlatTreeRow[]
insertChild
insertChild<T>(rows, parentIndex: number, node: T, adapter: FlatTreeAdapter, options?: FlatTreeOptions)
Type parameters :
  • T

Insert node as the first child of the row at parentIndex.

Parameters :
Name Type Optional
rows No
parentIndex number No
node T No
adapter FlatTreeAdapter No
options FlatTreeOptions Yes
Returns : FlatTreeRow[]
maxLevelBelow
maxLevelBelow<T>(above, adapter: FlatTreeAdapter, options?: FlatTreeOptions)
Type parameters :
  • T

The deepest level a row directly below above may have (0 if there is no row above).

Parameters :
Name Type Optional
above No
adapter FlatTreeAdapter No
options FlatTreeOptions Yes
Returns : number
moveSubtree
moveSubtree<T>(rows, previousIndex: number, currentIndex: number, adapter: FlatTreeAdapter, options?)
Type parameters :
  • T

Move the subtree rooted at previousIndex to currentIndex (as reported by a cdkDropList, which only moves the dragged row itself — its descendants follow it here) and re-nest it by levelDelta levels, within what the rows it comes to rest between allow.

Parameters :
Name Type Optional
rows No
previousIndex number No
currentIndex number No
adapter FlatTreeAdapter No
options Yes
Returns : FlatTreeRow[]
normalizeLevels
normalizeLevels<T>(rows, adapter: FlatTreeAdapter, options?: FlatTreeOptions)
Type parameters :
  • T

Clamp levels so the flat list always describes a valid tree: the first row is at level 0, every other row is at most one level deeper than the row above it — and only deeper if that row can have children at all — and no row is deeper than maxLevel.

Parameters :
Name Type Optional
rows No
adapter FlatTreeAdapter No
options FlatTreeOptions Yes
Returns : FlatTreeRow[]
rebuildTree
rebuildTree<T>(rows, adapter: FlatTreeAdapter)
Type parameters :
  • T

Reconstruct the nested tree from flat rows: each row owns the following rows of greater level.

Parameters :
Name Type Optional
rows No
adapter FlatTreeAdapter No
Returns : T[]
removeSubtree
removeSubtree<T>(rows, index: number, adapter: FlatTreeAdapter, options?: FlatTreeOptions)
Type parameters :
  • T

Remove the row at index together with its whole subtree.

Parameters :
Name Type Optional
rows No
index number No
adapter FlatTreeAdapter No
options FlatTreeOptions Yes
Returns : FlatTreeRow[]
subtreeLength
subtreeLength<T>(rows, index: number)
Type parameters :
  • T

Number of rows forming the subtree rooted at index (the row itself plus its descendants).

Parameters :
Name Type Optional
rows No
index number No
Returns : number
updateRow
updateRow<T>(rows, index: number, node: T)
Type parameters :
  • T

Replace the node of the row at index, keeping its position and nesting.

Parameters :
Name Type Optional
rows No
index number No
node T No
Returns : FlatTreeRow[]

src/app/core/basic-datatypes/string/display-text/display-text.component.ts

format
format(value)

Primitives (and arrays of them) already stringify readably, only objects need explicit formatting - otherwise they would render as "[object Object]".

Parameters :
Name Optional
value No
Returns : unknown

src/app/core/config/config-validation/config-validation.service.ts

formatProblem
formatProblem(problem: ConfigProblem)
Parameters :
Name Type Optional
problem ConfigProblem No
Returns : string

src/app/core/basic-datatypes/date-range/edit-date-range/edit-date-range.component.ts

fromDateString
fromDateString(value: string)

a date as "YYYY-MM-DD" (as the panel returns the picked dates), in local time

Parameters :
Name Type Optional
value string No
Returns : Date
isSameDate
isSameDate(a?, b?)
Parameters :
Name Optional
a Yes
b Yes
Returns : boolean
startOfDay
startOfDay(date: Date)
Parameters :
Name Type Optional
date Date No
Returns : Date

src/app/features/attendance/demo-data/demo-activity-generator.service.ts

generateActivity
generateActivity(__namedParameters: {participants: Entity[], assignedUser: Entity, title: string, entityType: string})
Parameters :
Name Type Optional Default value
participants Entity[] No
assignedUser Entity No
title string No
entityType string No "RecurringActivity"
Returns : ActivityEntity

src/app/child-dev-project/children/demo-data-generators/demo-child-generator.service.ts

generateChild
generateChild(opts)
Parameters :
Name Optional Default value
opts No {}

src/app/features/notification/notification-settings/notification-settings.component.ts

generateDefaultNotificationConfig
generateDefaultNotificationConfig(userId: string, userEntity: string)
Parameters :
Name Type Optional
userId string No
userEntity string No

src/app/core/entity/entity-field-edit/dynamic-edit/edit-component-story-utils.ts

generateFormFieldStory
generateFormFieldStory<T>(editComponent: unknown, defaultValue: unknown, withTooltip: unknown, additionalSchema: object, additionalProviders: [])
Type parameters :
  • T
Parameters :
Name Type Optional Default value Description
editComponent unknown No
defaultValue unknown No
withTooltip unknown No true

set to false to disable tooltip (?) button

additionalSchema object No {}

an object that is applied to the schema field and allows to overwrite or add schema properties

additionalProviders [] No []

Angular service providers that should be initialized in addition to defaults

src/app/child-dev-project/notes/demo-data/demo-note-generator.service.ts

generateGroupNote
generateGroupNote(params)
Parameters :
Name Optional
params No
generateNote
generateNote(params)
Parameters :
Name Optional
params No
Returns : Note
generateNotes
generateNotes(params)
Parameters :
Name Optional
params No
Returns : Note[]
removeFollowUpMarkerForOldNotes
removeFollowUpMarkerForOldNotes(note: Note)

Set all older notes to be "resolved" in order to keep the list of notes needing follow-up limited in the demo.

Parameters :
Name Type Optional
note Note No

src/app/utils/generate-id-from-label/generate-id-from-label.ts

generateIdFromLabel
generateIdFromLabel(label: string)

Create a simplified id string from the given text. This generates a camelCase string, removing special characters.

Parameters :
Name Type Optional Description
label string No

The input string to be transformed

Returns : string | undefined

src/app/features/todos/recurring-interval/time-interval.ts

generateLabelFromInterval
generateLabelFromInterval(interval: TimeInterval)
Parameters :
Name Type Optional
interval TimeInterval No

src/app/features/todos/model/demo-todo-generator.service.ts

generateTodo
generateTodo(__namedParameters: {entity: Entity, assignedTo: Entity[], isDue: boolean})
Parameters :
Name Type Optional
entity Entity No
assignedTo Entity[] No
isDue boolean No
Returns : Todo
generateTodos
generateTodos(params)
Parameters :
Name Optional
params No
Returns : Todo[]

src/app/core/user/demo-user-generator.service.ts

generateUsers
generateUsers()

src/app/features/inherited-field/get-common-value.ts

getCommonValue
getCommonValue(values)

Get the value that all given values have in common, ignoring empty values (and the order of items in array values, see isSameValue).

Parameters :
Name Optional Description
values No

the values to compare (all in the same format)

Returns : CommonValue
isSameValue
isSameValue(a, b)

Whether two field values are the same, ignoring the order of items if both are arrays (e.g. the selected options of a multi-select field), as well as duplicate items.

Parameters :
Name Optional Description
a No

a value in database format

b No

another value in the same format

Returns : boolean

src/app/features/inherited-field/inherited-value.service.ts

getConfigsForInheritedMode
getConfigsForInheritedMode(fieldConfigs)

Get the default value configs filtered for the given mode, excluding automation rules (with sourceReferenceEntity), which are handled by the AutomatedFieldUpdateConfigService.

Parameters :
Name Optional
fieldConfigs No

src/app/core/common-components/entities-table/data-source/data-source-resolver.ts

getDataSource
getDataSource(registry: DataSourceRegistry, dataSource?: string, loaderMethod?: LoaderMethod, entityType?: EntityConstructor)
Parameters :
Name Type Optional
registry DataSourceRegistry No
dataSource string Yes
loaderMethod LoaderMethod Yes
entityType EntityConstructor Yes
pagesOnServer
pagesOnServer(DataSourceClass: DataSourceConstructor)

whether the data source is the PaginatedDataSource or one of a feature module built on it

Parameters :
Name Type Optional
DataSourceClass DataSourceConstructor No
Returns : boolean
resolveDataSource
resolveDataSource<T extends Entity>(injector: Injector, dataSource?, loaderMethod?: LoaderMethod, entityType?: EntityConstructor)
Type parameters :
  • T extends Entity

Create the data source for a table.

Parameters :
Name Type Optional Description
injector Injector No

the injection context the data source lives in (and is destroyed with)

dataSource Yes

name of a data source in the DataSourceRegistry, or its name with options, as configured for the list

loaderMethod LoaderMethod Yes

special loader the records come from, if any

entityType EntityConstructor Yes

type of the listed records

supportsPagination
supportsPagination(injector: Injector)
Parameters :
Name Type Optional
injector Injector No
Returns : boolean

src/app/core/config/testing-config-service.ts

getDefaultConfigEntity
getDefaultConfigEntity(configsObject: any)
Parameters :
Name Type Optional Default value
configsObject any No defaultJsonConfig
provideTestingConfigService
provideTestingConfigService(configsObject: any)
Parameters :
Name Type Optional Default value
configsObject any No defaultJsonConfig

src/app/core/basic-datatypes/configurable-enum/configurable-enum-testing.ts

getDefaultEnumEntities
getDefaultEnumEntities()
Returns : ConfigurableEnum[]

src/bootstrap-pwa-install.ts

getDeferredInstallPrompt
getDeferredInstallPrompt()

The deferred install prompt, if the browser has offered one already.

registerPWAInstallListener
registerPWAInstallListener()

Start listening for the browser's beforeinstallprompt event and defer it, so that the app can offer an install button at any later point.

Must be called before any async operation during bootstrap, because the browser fires the event early and does not replay it for later listeners.

Returns : void
resetPWAInstallListener
resetPWAInstallListener()

Discard the deferred prompt and the listener's promise, and remove the beforeinstallprompt listener from window. Only needed in tests, to undo the module-level state of a previous case.

Returns : void
whenCanInstallDirectly
whenCanInstallDirectly()

Resolves once/if the app can be installed directly. undefined if registerPWAInstallListener has not run.

Returns : Promise | undefined

src/app/core/entity/schema/embedded-schema-field.util.ts

getEmbeddedEntityReferenceFields
getEmbeddedEntityReferenceFields(schemaService: EntitySchemaService, field)

The inner entity-reference properties of an embedded field (e.g. the "participant" of an attendance field), resolved through the field's datatype, so that inner fields only partially overridden in additional are included as well.

Parameters :
Name Type Optional
schemaService EntitySchemaService No
field No
Returns : unknown[]
getEmbeddedFieldId
getEmbeddedFieldId(ref: EmbeddedFieldRef)

The id referencing the given nested property, e.g. "childrenAttendance.participant".

Parameters :
Name Type Optional
ref EmbeddedFieldRef No
Returns : string
getEmbeddedFieldLabel
getEmbeddedFieldLabel(ref: EmbeddedFieldRef)

Compose the display label for a property nested inside an embedded field, e.g. "Children attendance -> Participant".

Parameters :
Name Type Optional
ref EmbeddedFieldRef No
Returns : string
getEmbeddedFieldRefs
getEmbeddedFieldRefs(schemaService: EntitySchemaService, entityConstructor: EntityConstructor)

List all properties nested inside embedded fields of the given entity type (e.g. "childrenAttendance.participant"), for offering them as filter (or other) options in addition to the entity's normal, flat schema fields.

Parameters :
Name Type Optional
schemaService EntitySchemaService No
entityConstructor EntityConstructor No
Returns : EmbeddedFieldRef[]
getEmbeddedSchema
getEmbeddedSchema(schemaService: EntitySchemaService, field)

Build the map of inner schema fields of an embedded field, the same way the datatype itself (de)serializes them (see SchemaEmbedDatatype.getEffectiveSchema).

Returns undefined if the field is not an embedded schema field (i.e. has no inner fields).

Parameters :
Name Type Optional
schemaService EntitySchemaService No
field No
getSchemaEmbedDatatype
getSchemaEmbedDatatype(schemaService: EntitySchemaService, field)

The datatype of the given field, if it is an embedded schema field (e.g. dataType: "schema-embed" or "attendance").

Parameters :
Name Type Optional
schemaService EntitySchemaService No
field No
resolveEmbeddedField
resolveEmbeddedField(schemaService: EntitySchemaService, entityConstructor: EntityConstructor, fieldId: string)

Resolve a field id that may reference a property nested inside an embedded field (e.g. "childrenAttendance.participant") into its outer/inner schema parts.

Returns undefined if the id does not reference such a nested property (e.g. a normal, flat field id, or an invalid/unknown path).

Parameters :
Name Type Optional
schemaService EntitySchemaService No
entityConstructor EntityConstructor No
fieldId string No

src/app/core/entity/entity-config.service.ts

getEntityRuntimeDetailsRoutePath
getEntityRuntimeDetailsRoutePath(entityType: EntityConstructor)
Parameters :
Name Type Optional
entityType EntityConstructor No
Returns : string
getEntityRuntimeRoute
getEntityRuntimeRoute(entityType: EntityConstructor)
Parameters :
Name Type Optional
entityType EntityConstructor No
Returns : string

src/app/core/config/dynamic-routing/route-paths.ts

getEntityRuntimePath
getEntityRuntimePath(path: string)

Build the canonical runtime path for config-driven entity routes.

Parameters :
Name Type Optional
path string No
Returns : string
getRuntimePathFromViewConfig
getRuntimePathFromViewConfig(view: ViewConfig)

Resolve the effective route path for a view config at runtime. Entity views are always placed under CONFIG_ENTITY_ROUTE_PREFIX.

Parameters :
Name Type Optional
view ViewConfig No
Returns : string
getViewPathFromConfigId
getViewPathFromConfigId(viewConfigId: string)

Convert a view:* config id into a plain route path.

Parameters :
Name Type Optional
viewConfigId string No
Returns : string
isEntityViewConfig
isEntityViewConfig(view: ViewConfig)

Heuristic to identify config views that represent entity navigation. Includes views with an explicit entityType config and detail views (path ending with /:id).

Parameters :
Name Type Optional
view ViewConfig No
Returns : boolean
normalizeRoutePath
normalizeRoutePath(path: string)

Normalize a route path for internal comparisons. Removes a single leading slash and keeps nested segments unchanged.

Parameters :
Name Type Optional
path string No
Returns : string

src/app/core/entity/entity-field-edit/dynamic-edit/edit-component.interface.ts

getExistingValuesToHighlight
getExistingValuesToHighlight<V>(component: EditComponent)
Type parameters :
  • V

The values that the entity has saved in the field of the edit component, to highlight the selected values that are added to them (only if highlightAdded is set).

They are taken from the entity, because the form control can already hold a new value when the edit component is created (e.g. a suggested value in the "Update related records" dialog).

Parameters :
Name Type Optional
component EditComponent No
Returns : [] | undefined

src/app/core/common-components/entity-form/entity-form/entity-form.component.ts

getFieldId
getFieldId(field: ColumnConfig)
Parameters :
Name Type Optional
field ColumnConfig No
Returns : string | undefined
hasDisplayCondition
hasDisplayCondition(item)
Parameters :
Name Optional
item No
Returns : boolean

src/app/features/reporting/report-row.ts

getGroupingInformationString
getGroupingInformationString(groupedBy)
Parameters :
Name Optional
groupedBy No
Returns : string
getValueDescription
getValueDescription(value: any, property: string)
Parameters :
Name Type Optional
value any No
property string No
Returns : string

src/app/core/import/import-inheritance-warning.util.ts

getInheritanceSourceReferenceFields
getInheritanceSourceReferenceFields(entityCtor?: EntityConstructor)

Shared helper for import warnings related to inherited fields.

It centralizes detection of source-reference fields used by inherited-field defaults so mapping dialogs and import summary can show consistent hints without duplicating schema-scanning logic.

Parameters :
Name Type Optional
entityCtor EntityConstructor Yes
Returns : Set<string>
hasMappedInheritedSourceField
hasMappedInheritedSourceField(entityCtor: EntityConstructor, columnMappings)
Parameters :
Name Type Optional
entityCtor EntityConstructor No
columnMappings No
Returns : boolean
isInheritanceSourceReferenceField
isInheritanceSourceReferenceField(entityCtor: EntityConstructor, propertyName?: string)
Parameters :
Name Type Optional
entityCtor EntityConstructor No
propertyName string Yes
Returns : boolean

src/app/core/entity/schema/entity-reference-fields.ts

getInnerEntityReferenceFields
getInnerEntityReferenceFields(innerSchema)

From the inner schema of an embedded field, return the entries whose dataType is "entity" (i.e. inner entity-reference properties).

Returns an empty array when there is no inner schema.

This is shared between the in-memory check which fields of a record reference an entity (see EntityRelationsService) and the database query selecting candidate records (see DefaultDatatype.getReferenceSelector), so that the two cannot disagree about which inner properties hold a reference. To resolve the inner schema of a field, use getEmbeddedEntityReferenceFields.

Parameters :
Name Optional
innerSchema No
Returns : unknown[]

src/app/features/inherited-field/automated-field-update/affected-entities-calculation.ts

getLinkedIds
getLinkedIds(entity, rule: DefaultValueConfigInheritedField)

The ids of the entities that the entity links to in the reference field of the rule

Parameters :
Name Type Optional
entity No
rule DefaultValueConfigInheritedField No
Returns : string[]

src/app/features/dashboard-widgets/birthday-dashboard-widget/birthday-dashboard/birthday-dashboard-index.service.ts

getNextOccurrence
getNextOccurrence(date: Date, today: Date)

Real calendar date of the next occurrence (this year, or next year if it has already passed) of the given date's month/day, relative to today.

Uses the native Date constructor (not moment) on purpose: its month/day overflow folds a Feb 29 birthday onto March 1 in non-leap years, matching how the index's reference-year day-of-year keys treat it. moment([y, m, d]) would instead be invalid.

Parameters :
Name Type Optional
date Date No
today Date No
Returns : Date
parseDateOnly
parseDateOnly(value: string)

Parse a stored date-of-birth value into a Date at local midnight.

moment() reads an ISO date string ("YYYY-MM-DD") in local time, whereas new Date("2020-01-15") reads it as UTC and would then land on the previous day via the local getFullYear()/getMonth()/getDate() accessors used downstream. moment.ISO_8601 also covers any legacy value still stored as a full ISO timestamp, normalizing it to the local calendar day.

Parameters :
Name Type Optional
value string No
Returns : Date
toPropertyList
toPropertyList(properties)
Parameters :
Name Optional
properties No
Returns : string[]

src/app/core/basic-datatypes/entity/selection-condition.ts

getPlaceholderLinkedRecordIds
getPlaceholderLinkedRecordIds(condition, record)

The ids of the records that the given record links to in the fields through which placeholders of the condition refer to a field of a linked record (e.g. the parent for "$current_record.parentAction.locations"). Values that are not an id are only left out when loading the records (see loadLinkedRecords).

Parameters :
Name Optional
condition No
record No
Returns : unknown[]
matchesSelectionCondition
matchesSelectionCondition<E extends Entity>(condition, filterService: FilterService)
Type parameters :
  • E extends Entity

Whether a record matches a resolved selectionCondition (any record does if the condition is invalid).

Parameters :
Name Type Optional
condition No
filterService FilterService No
Returns : boolean
registerLinkedRecordsSource
registerLinkedRecordsSource(control: AbstractControl, source: LinkedRecordsSource)

Share the records a dropdown has loaded with the validators of its form control.

Parameters :
Name Type Optional
control AbstractControl No
source LinkedRecordsSource No
Returns : void

a function to call when the dropdown is not bound to the control anymore

resolveSelectionCondition
resolveSelectionCondition<E extends Entity>(condition, entityTypes, record, placeholderService: DynamicPlaceholderValueService, linkedRecords?)
Type parameters :
  • E extends Entity

The selectionCondition of a field linking to other records, with its placeholders referring to the record being edited resolved, or undefined if it does not apply: none is configured, none of its rows can be applied, or the field links to several record types (with different fields).

Parameters :
Name Type Optional Description
condition No
entityTypes No
record No
placeholderService DynamicPlaceholderValueService No
linkedRecords Yes

the records that the record links to, for placeholders referring to their fields (see getPlaceholderLinkedRecordIds)

src/app/core/common-components/entities-table/value-accessor/value-accessor.ts

getReadableValue
getReadableValue(value: any)

An enhanced sortingDataAccessor function that can be set for a MatTableDataSource in order to support sorting by ConfigurableEnum columns and other Entity specific values.

Parameters :
Name Type Optional Description
value any No

the object for which a readable string should be returned

Returns : any
isConfigurableEnum
isConfigurableEnum(value: any)
Parameters :
Name Type Optional
value any No
isGeoLocation
isGeoLocation(value: any)
Parameters :
Name Type Optional
value any No
Returns : GeoLocation
transformToReadableFormat
transformToReadableFormat(obj: any)

Transform a whole object into a readable format. This also transforms date objects to YYYY-MM-DD format.

Parameters :
Name Type Optional
obj any No

src/app/features/reporting/edit-report-definition/report-definition-ui-node.ts

getReportDefinitionEntryError
getReportDefinitionEntryError(entry: ReportDefinitionDto, hasItems: unknown)

Why a report-definition entry cannot be calculated, or undefined if it can. Mirrors the rule the backend enforces: every entry needs a non-empty query, or a non-empty groupTitle with non-empty items.

Parameters :
Name Type Optional Default value Description
entry ReportDefinitionDto No

the entry to check (its child entries are not checked)

hasItems unknown No (entry.items?.length ?? 0) > 0

whether the entry has child entries; in the editor's flat rows these are rows of their own rather than the entry's items

Returns : string | undefined
hasInvalidReportDefinitionEntry
hasInvalidReportDefinitionEntry(entries)

Whether any entry of the definition, at any nesting level, cannot be calculated.

Parameters :
Name Optional
entries No
Returns : boolean
isGroupDto
isGroupDto(dto: ReportDefinitionDto)

A persisted entry is a group when it carries items, or a groupTitle but no query (an incomplete group, which must keep its title to be fixed in the editor).

Parameters :
Name Type Optional
dto ReportDefinitionDto No
Returns : boolean
isGroupNode
isGroupNode(node: ReportDefinitionUiNode)

A node is a group when it carries an items array; otherwise it is a query.

Parameters :
Name Type Optional
node ReportDefinitionUiNode No
Returns : boolean
newGroupNode
newGroupNode()

A new, empty group node.

newQueryNode
newQueryNode()

A new, empty query node.

toReportDefinition
toReportDefinition(nodes)

Convert UI nodes back to plain report-definition DTOs (dropping the transient ids).

Parameters :
Name Optional
nodes No
toUiNodes
toUiNodes(dtos)

Convert persisted report-definition DTOs into UI nodes with transient ids.

Parameters :
Name Optional
dtos No

src/app/core/permissions/reserved-roles.ts

getReservedRole
getReservedRole(roleName: string)

details of the given reserved role, or undefined if it is an ordinary role

Parameters :
Name Type Optional
roleName string No
Returns : ReservedRoleInfo | undefined
roleDisplayName
roleDisplayName(roleName: string)

the reserved role's readable name, or the plain role name for ordinary roles

Parameters :
Name Type Optional
roleName string No
Returns : string

src/app/features/inherited-field/automated-field-update/automated-field-update.component.ts

getRowKey
getRowKey(row: AffectedEntity)
Parameters :
Name Type Optional
row AffectedEntity No
Returns : string

src/app/core/basic-datatypes/schema-embed/schema-embed-array-columns.ts

getSchemaEmbedArrayColumns
getSchemaEmbedArrayColumns(fieldConfig, entitySchemaService: EntitySchemaService, columns?)

Resolve the inner fields of a schema-embed-array field as table columns through the field's datatype (see SchemaEmbedDatatype.getColumns).

Parameters :
Name Type Optional Description
fieldConfig No

the schema-embed-array field (holding the inner fields in additional)

entitySchemaService EntitySchemaService No

to look up the field's datatype

columns Yes

optional selection (and overrides) of the inner fields, in display order

Returns : FormFieldConfig[]

the columns, or none if the field is not of a schema-embed datatype

src/app/features/api-client/api-client-scopes.ts

getScopeDocumentation
getScopeDocumentation(scopes)
Parameters :
Name Optional
scopes No
Returns : string[]
getScopeLabel
getScopeLabel(scope: string, description?: string)
Parameters :
Name Type Optional
scope string No
description string Yes
Returns : string

src/app/utils/media/visible-columns.ts

getVisibleColumnIds
getVisibleColumnIds(columns, screenSize: ScreenSize)

Ids of the table columns to be displayed on the given screen size, leaving out columns with hideFromTable and those configured visibleFrom a larger screen size only.

Parameters :
Name Type Optional
columns No
screenSize ScreenSize No
Returns : string[]
injectCurrentScreenSize
injectCurrentScreenSize()

The current screen size as a signal, updated whenever the screen width crosses a breakpoint.

Must be called in an injection context (e.g. a field initializer of a component).

Returns : Signal<ScreenSize>

src/app/child-dev-project/warning-level.ts

getWarningLevelColor
getWarningLevelColor(warningLevel: WarningLevel)
Parameters :
Name Type Optional
warningLevel WarningLevel No

src/app/core/permissions/permission-action-labels.ts

grantedByAdvancedRuleTooltip
grantedByAdvancedRuleTooltip()

Explains a checkbox that is ticked but disabled because a rule this UI cannot express (wildcard subject, grouped subjects, conditions, an inverted rule or a rule managed by the server) decides the access.

Returns : string
grantedByDefaultRoleTooltip
grantedByDefaultRoleTooltip()

Explains a checkbox that is ticked but disabled because the shared default role already grants the action to every logged-in user.

Returns : string

src/app/core/entity/entity-mapper/entity-relations.service.ts

groupByReferencedId
groupByReferencedId<T extends Entity>(entities, ids: Set, referencedIdsOf)
Type parameters :
  • T extends Entity

Group the entities by which of the given ids they reference. An entity referencing several of the ids is listed for each of them.

Parameters :
Name Type Optional
entities No
ids Set No
referencedIdsOf No
Returns : Map<string, T[]>
referencedIdsIn
referencedIdsIn(value, innerKeys)

The ids a field value references: the plain id(s), or for embedded objects the ids in their inner reference properties (all their values, if innerKeys is empty).

Parameters :
Name Optional
value No
innerKeys No
Returns : unknown[]

src/app/core/basic-datatypes/configurable-enum/configurable-enum-ordering.ts

hasOrdinalValue
hasOrdinalValue(value: any)
Parameters :
Name Type Optional
value any No
Returns : HasOrdinal
imposeTotalOrdering
imposeTotalOrdering<T extends ConfigurableEnumValue>(values: Array)
Type parameters :
  • T extends ConfigurableEnumValue

Extends an array of configurable enum values with an ordinal value so that the ordinal value of each enum value matches the position of the element in the array.

Note that this should be used 'early' in the pipeline, i.e. when the ConfigurableEnumConfig is just created. It is technically not incorrect to use this function on any array that contains configurable enum values, but it doesn't make sense to apply this function to 'scrambled' arrays, i.e. arrays where the ordering of values is not the natural order of these values.

Parameters :
Name Type Optional Description
values Array No

The values to impose a total ordering on

src/app/core/database/pouchdb/indexeddb-sequence-check.ts

hasOutdatedSequenceCounter
hasOutdatedSequenceCounter(db)

Whether the local database's stored sequence counter is behind the sequence numbers of its documents, so that every write fails (see above). Only reads the database; false for other adapters or if it cannot be read.

Parameters :
Name Optional
db No
Returns : Promise<boolean>
isAbortedTransaction
isAbortedTransaction(error)

Whether PouchDB rejected the call because its IndexedDB transaction was aborted.

Parameters :
Name Optional
error No
Returns : boolean
openExistingDatabase
openExistingDatabase(name: string)

Open the IndexedDB at its current version, without creating it if it does not exist (as the version change of a new database is aborted). The connection closes itself if PouchDB opens the database at a new version (as it does on every reopen), so that it never blocks the adapter.

Parameters :
Name Type Optional
name string No
request
request<T>(idbRequest: IDBRequest)
Type parameters :
  • T
Parameters :
Name Type Optional
idbRequest IDBRequest No
Returns : Promise<T>

src/app/features/notification/firebase-messaging.service.ts

hasPushApis
hasPushApis()

Quick check of the browser APIs, so the SDK (which checks support in detail) is not downloaded without them.

Returns : boolean

src/app/core/session/session-type.ts

hasRemoteSession
hasRemoteSession(sessionType: SessionType)

Check whether the given session type has a remote server connection. This is true for both "synced" (local+remote) and "online" (remote-only) modes.

Parameters :
Name Type Optional
sessionType SessionType No
Returns : boolean

src/app/core/admin/admin-widget-dialog/admin-widget-dialog.component.ts

hasText
hasText(value)

whether a plain or multi-lingual text has any non-blank text in some language

Parameters :
Name Optional
value No
Returns : boolean

src/app/core/entity-list/entity-list/entity-list.component.ts

indexOfGroupWithFewestColumns
indexOfGroupWithFewestColumns(groups)

The column group shown on small screens: the one with the fewest columns (the first of them if several have the same number).

Parameters :
Name Optional
groups No
Returns : number

src/app/core/permissions/permission-types.ts

inheritsDefaultRules
inheritsDefaultRules(roleName: string)

Whether users of the given role also receive the shared "_default" rules. False for "_default", which cannot inherit from itself, and for "_public", which applies to visitors who are not logged in and never get the "_default" rules (see AbilityService.getRulesForUser).

The excluded keys are listed explicitly instead of taken from RESERVED_RULE_CONFIG_KEYS, because a future reserved role that applies to logged-in users would inherit the "_default" rules as usual.

Parameters :
Name Type Optional
roleName string No
Returns : boolean
isReservedRuleConfigKey
isReservedRuleConfigKey(key: string)

Whether a key in DatabaseRules carries special semantics instead of naming a user role, so it must neither be resolved as a role nor rewritten by a per-role UI. Covers the reserved underscore prefix as well as the explicitly listed RESERVED_RULE_CONFIG_KEYS.

Parameters :
Name Type Optional
key string No
Returns : boolean
ruleAppliesToSubject
ruleAppliesToSubject(subject, entityType: string)

Whether the rule applies to the given entity type, ignoring conditions and inversion. all matches every entity type.

Parameters :
Name Type Optional
subject No
entityType string No
Returns : boolean
ruleCoversAction
ruleCoversAction(rule: DatabaseRule, entityType: string, action: EntityActionPermission)

Whether the rule grants the given action for the entity type, ignoring conditions and inversion. manage covers every other action, and a rule can list several actions as an array.

Parameters :
Name Type Optional
rule DatabaseRule No
entityType string No
action EntityActionPermission No
Returns : boolean

src/app/features/inherited-field/inherited-field-config.ts

isCollectingFromLinkedRecords
isCollectingFromLinkedRecords(field)

Whether the field collects the values of all related records that link to this record (e.g. a school's field collecting the cities of all its children), adding to the existing values instead of replacing them.

Parameters :
Name Optional
field No
Returns : boolean
isInheritingFromParent
isInheritingFromParent(field)

Whether the field inherits the value of the parent records this record links to in one of its fields (unlike automation rules with a sourceReferenceEntity, which update the value from the side of the related records).

Parameters :
Name Optional
field No
Returns : boolean

src/app/utils/is-empty-value.ts

isEmptyValue
isEmptyValue(value)

Whether the value is empty, i.e. not set or an empty text or list.

Parameters :
Name Optional
value No
Returns : boolean

src/app/features/location/address-gps-location/address-gps-location.component.ts

isExpectedLocationFailure
isExpectedLocationFailure(error)

Failures caused by the device rather than a defect: a denied or blocked location permission, no position available or a timeout. The user is told in any case. (A failed address lookup does not get here: GeoService.reverseLookup falls back to the plain coordinates.)

Parameters :
Name Optional
error No
Returns : boolean

src/app/core/admin/admin-menu/menu-item-for-admin-ui.ts

isManualItemWithoutLink
isManualItemWithoutLink(item)

True when an item is in manual mode (no entity type) and no link has been set.

Parameters :
Name Optional
item No
Returns : boolean

src/app/features/de-duplication/duplicate-detection.service.ts

isMatchableField
isMatchableField(field: EntitySchemaField)

Whether duplicates can be detected by comparing this field at all.

Array values and objects without a plain id normalize to "", which excludes the record from matching entirely - so offering such a field would silently return "no duplicates found" rather than no result for that field.

Parameters :
Name Type Optional
field EntitySchemaField No
Returns : boolean
normalizeValue
normalizeValue(value)

The comparable form of a field value, or "" where it cannot be compared.

Parameters :
Name Optional
value No
Returns : string

src/app/core/setup/base-config.ts

isOfferedInLocale
isOfferedInLocale(config: Pick, locale: string)

Whether a base config is offered in the given locale.

Matches the base language too, so a config listing en is offered for en-US - partners write these files by hand.

Parameters :
Name Type Optional
config Pick No
locale string No
Returns : boolean

src/app/core/basic-datatypes/date-range/is-outside-range.ts

isOutsideRange
isOutsideRange(range, outer)

Whether the range goes beyond the outer range (compared by day).

A missing date leaves the range open on that side (e.g. no end date = ongoing), so it goes beyond an outer range that has a date on that side. An empty range or outer range never counts as outside.

Parameters :
Name Optional
range No
outer No
Returns : boolean

src/app/core/database/remote-only-databases.ts

isRemoteOnlyDatabase
isRemoteOnlyDatabase(dbName: string)

Whether the given database name belongs to an entity type that declares Entity.DATABASE_REMOTE_ONLY.

This reads the module-level registry rather than an injected one, so that DatabaseResolverService can decide how to create a database without taking a dependency on the entity layer's DI graph.

Parameters :
Name Type Optional
dbName string No
Returns : boolean

src/app/core/session/auth/keycloak/keycloak-auth.service.ts

isRetryableNetworkError
isRetryableNetworkError(err: any)

Check whether an error is a retryable network/connectivity error, including keycloak-specific transient failures.

Parameters :
Name Type Optional
err any No
Returns : boolean
keycloakFailureContext
keycloakFailureContext(err: any)

What a failed Keycloak operation can say about itself beyond its message.

keycloak-js reports every rejected response as Server responded with an invalid status. and attaches the whole Response as NetworkError.response rather than lifting the status out of it - so the report names neither which status it was nor which endpoint refused, and the error cannot be told apart from any other by reading it.

The status alone does not say why Keycloak refused (e.g. a 400 from the token endpoint can be an expired, reused or mismatched code), so the response body is read as well: the OAuth error / error_description if it is JSON, or a short excerpt otherwise (e.g. an HTML error page from a proxy in front).

Passed as log context rather than interpolated into the message, so that all occurrences stay one issue in remote monitoring (see core/logging/README.md) while the details are one click away in the event's data.

Parameters :
Name Type Optional
err any No
Returns : Promise<Record<string, unknown>>
keycloakOperation
keycloakOperation<T>(operation)
Type parameters :
  • T

Run a keycloak-js network operation, bounded by KEYCLOAK_OPERATION_TIMEOUT_MS, and convert its failure where it enters the app (see toTypedKeycloakError).

Parameters :
Name Optional
operation No
Returns : Observable<T>
readResponseBody
readResponseBody(response: Response)

Best-effort read of a failed response's body for diagnostics. Never throws: a body that cannot be read only means less detail in the report.

Parameters :
Name Type Optional
response Response No
Returns : Promise<Record<string, unknown>>
toTypedKeycloakError
toTypedKeycloakError(err: any)

The error of a failed keycloak-js operation: a ConnectivityError (with the original as cause) if Keycloak could not be reached - no response or a gateway status, a failed fetch, or our timeout for the operation. Any other error (e.g. a 400 for a login code no longer valid) is returned as it is.

Parameters :
Name Type Optional
err any No
Returns : unknown

src/app/core/language/language-statics.ts

isRtlLocale
isRtlLocale(locale: string)

Matches on the language subtag, so regional variants like ar-EG are covered too.

Parameters :
Name Type Optional
locale string No
Returns : boolean
isValidLocale
isValidLocale(value)

Whether the given value can be used as a locale to look up translations.

Non-string values (e.g. a whole dropdown option object) are silently stringified by localStorage and would end up being requested from the translations CDN, so they have to be rejected before they are stored or used.

Parameters :
Name Optional
value No
Returns : string

src/app/core/filter/filter.service.ts

isSingleOptionList
isSingleOptionList(value)

a list with exactly one option, which can be applied as plain value

Parameters :
Name Optional
value No
Returns : [unknown]

src/app/core/export/readable-entity-name.ts

isUnresolvableReferenceError
isUnresolvableReferenceError(err: any)

Whether the error means the referenced entity cannot be resolved at all (rather than a failure that may succeed on another attempt).

"No permission" includes the server's 401 "User is not permitted", but not an expired session, which is a 401 as well (see isNotPermittedError).

Parameters :
Name Type Optional
err any No
Returns : boolean
loadReadableEntityName
loadReadableEntityName(entityMapper: EntityMapperService, entityType, entityId: string, cache?: Map)

Load a referenced entity and return its human-readable name for exports.

Only a reference that really cannot be resolved (deleted, no permission, unknown type) results in ENTITY_NOT_FOUND_PLACEHOLDER. Any other failure (connection problem, expired session, server error) is NOT disguised as "not found" - it is rethrown, so that the export fails visibly instead of silently containing wrong data for an entity that does exist.

Parameters :
Name Type Optional Description
entityMapper EntityMapperService No

used to load the entity

entityType No

type to use if the id has no type prefix

entityId string No

id of the referenced entity (with or without type prefix)

cache Map Yes

optional, shared across one export run so every entity is loaded only once

Returns : Promise<string>
safeExtractType
safeExtractType(entityId: string)
Parameters :
Name Type Optional
entityId string No
Returns : string | undefined

src/app/core/admin/admin-entity-details/admin-entity-field/configure-entity-field-validator/configure-entity-field-validator.component.ts

isUnset
isUnset(value)

whether a validator's form control value means it is not set

Parameters :
Name Optional
value No
Returns : boolean
isValidRegex
isValidRegex(pattern: string)
Parameters :
Name Type Optional
pattern string No
Returns : boolean
validRegexValidator
validRegexValidator(control: AbstractControl)

Marks the control as invalid if its value cannot be compiled as a regular expression.

Parameters :
Name Type Optional
control AbstractControl No
Returns : ValidationErrors | null

src/app/core/database/pouchdb/bulk-write-batches.ts

jsonByteLength
jsonByteLength(object: any)

The size a document adds to a request body: UTF-8 bytes, not characters.

The server limits a request by its bytes, and a single character of a name written in a non-latin script takes several of them - so measuring the string length would under-count exactly the data most likely to be imported in bulk.

Parameters :
Name Type Optional
object any No
Returns : number
splitIntoRequests
splitIntoRequests(objects, limits: BulkWriteLimits)

Group the documents into batches that each stay within one request's budget.

A single document larger than the budget gets a request of its own: it cannot be split, and the limits it is measured against are not the only ones it may pass, so it is left to the server to accept or reject it.

Parameters :
Name Type Optional
objects No
limits BulkWriteLimits No
Returns : [][]
writeInBatchedRequests
writeInBatchedRequests(objects, writeRequest, limits: BulkWriteLimits, dbName: string)

Write the given documents through writeRequest, split across several requests where they do not fit into one (see BulkWriteLimits).

The requests are sent one after the other: the chunks of one call belong to a single user action, so sending them in parallel would only have them compete for connections while the server holds all of their bodies in memory at once.

The result reports what became of the documents the way Database.putAll does: the results in the order the documents were passed in, a rejection with those results when individual documents failed, and a PartialBulkWriteError when a request failed as a whole after an earlier one had stored documents.

Parameters :
Name Type Optional Description
objects No

the documents to write

writeRequest No

sends one request, following the Database.putAll contract

limits BulkWriteLimits No

the budgets one request has to stay within

dbName string No

the database being written to, for the log context

Returns : Promise<any[]>

src/app/core/database/pouchdb/synced-pouch-database.ts

lastSyncedBatchContext
lastSyncedBatchContext(docIds)

What of the last synced batch can be reported when a sync fails right after it: how much was in flight and which record types, but never the document ids themselves - those identify records and have no place in remote monitoring (see #4174), while as part of a message they would also open a separate issue per batch.

Parameters :
Name Optional
docIds No
Returns : Record<string, unknown>

src/app/core/basic-datatypes/entity/load-linked-records.ts

latestLinkedRecords
latestLinkedRecords(records)

The given records in their latest version: they are replaced while they change in the database (e.g. a parent record that an automated update changes after a record linking to it is saved), and left out once deleted. Must be called in an injection context (e.g. as a field initializer of a component).

Parameters :
Name Optional
records No
Returns : Signal<Entity[]>
loadLinkedRecord
loadLinkedRecord<E extends Entity>(entityMapper: EntityMapperService, entityType: string, id: string)
Type parameters :
  • E extends Entity

Load a record that a link field refers to, undefined if it cannot be loaded (not found, not permitted or of an unknown record type, which is not reported as a problem).

Parameters :
Name Type Optional
entityMapper EntityMapperService No
entityType string No
id string No
Returns : Promise<E | undefined>
loadLinkedRecords
loadLinkedRecords(entityMapper: EntityMapperService, ids, getLoaded)

Load the records with the given ids (the value of a link field), whatever their record types. Records that cannot be loaded (see loadLinkedRecord) and values that are not an id are left out.

Parameters :
Name Type Optional Default value Description
entityMapper EntityMapperService No
ids No
getLoaded No () => undefined

a record that is loaded already (e.g. by the dropdown of the field), which is not loaded again

Returns : Promise<Entity[]>

src/app/core/database/indexeddb-migration.service.ts

legacyDbConfig
legacyDbConfig(session: SessionInfo, migrationPending: boolean)
Parameters :
Name Type Optional
session SessionInfo No
migrationPending boolean No
Returns : DbConfig
migratedFlagKey
migratedFlagKey(session: SessionInfo)
Parameters :
Name Type Optional
session SessionInfo No
Returns : string
newDbConfig
newDbConfig(session: SessionInfo)
Parameters :
Name Type Optional
session SessionInfo No
Returns : DbConfig

src/app/child-dev-project/notes/deprecated/legacy-note-link-fields.ts

linkInLegacyField
linkInLegacyField(newNote: Note, field: string, ids)
Parameters :
Name Type Optional
newNote Note No
field string No
ids No
linkLegacyNoteFields
linkLegacyNoteFields(newNote: Note, entity: Entity)

Link a new note's source entity in the legacy Note fields, if the system still has them configured.

This only applies to a ChildSchoolRelation, whose child and school used to be linked in children / schools rather than in the generic relatedEntities. The children / schools fields are now only defined in the config of systems that still rely on them (see the v4-upgrade-note-legacy-child-school-fields CLI migration). Systems without those fields link both through relatedEntities (if permitted there).

Parameters :
Name Type Optional Description
newNote Note No

the note being created, modified in place

entity Entity No

the entity the new note is created from

src/app/core/database/pouchdb/pouch-database.ts

markAsSecondQuery
markAsSecondQuery(res: FindPage)
Parameters :
Name Type Optional
res FindPage No
Returns : FindPage

src/app/core/basic-datatypes/schema-embed/schema-embed.datatype.ts

mergeEmbeddedSchema
mergeEmbeddedSchema(baseSchema, additional)

Build the inner schema of an embedded field from the embedded type's own schema and the field's additional config (a SchemaEmbedDatatypeAdditional map).

An entry in additional only overrides what it states explicitly (e.g. restricting the allowed entity types of a reference), everything else (dataType, label, ...) is inherited from the embedded type's field of the same id.

Parameters :
Name Optional Description
baseSchema No

schema of the embedded type (e.g. embeddedType.schema), not mutated

additional No

the additional config of the field holding the embedded object(s)

Returns : EntitySchema

src/app/core/basic-datatypes/date-only/date-only.datatype.ts

migrateIsoDatesToInferredDateOnly
migrateIsoDatesToInferredDateOnly(value: string)
Parameters :
Name Type Optional
value string No
Returns : string

src/app/features/public-form/public-form.component.ts

migratePublicFormConfig
migratePublicFormConfig(formConfig: PublicFormConfig)
Parameters :
Name Type Optional
formConfig PublicFormConfig No
Returns : PublicFormConfig

src/app/utils/test-utils/dialog-mocks.ts

mockConfirmationDialog
mockConfirmationDialog(confirmed: unknown)

A ConfirmationDialogService whose prompts all resolve the same way.

Parameters :
Name Type Optional Default value Description
confirmed unknown No true

what the user is taken to have answered (default: they confirm)

mockMatDialog
mockMatDialog(result)

A MatDialog whose open() returns a ref that closes with result.

The dialog is never actually rendered, so this is about what the component does with the result - assert on .open for what was opened with which data.

Parameters :
Name Optional Default value Description
result No undefined

the value afterClosed() emits (default: closed without a result)

Returns : MatDialogMock
mockMatDialogRef
mockMatDialogRef(result)

A MatDialogRef, for the component inside a dialog rather than the one opening it.

Parameters :
Name Optional Default value Description
result No undefined

the value afterClosed() emits (default: closed without a result)

Returns : MatDialogRefMock

src/app/core/common-components/conditions-editor/condition-negation.ts

negate
negate(positive: any)

Wrap a positive fragment so it matches everything except itself.

$not only accepts a regular expression or an object of field operators, so anything else has to be expressed as $eq first. That includes an array, which the editor produces when the last value of a multi-select is removed. Handing $not such a value produces a condition the matcher rejects - and a rejected condition makes the whole rule unusable, which silently grants nothing.

Parameters :
Name Type Optional
positive any No
Returns : any
splitNegation
splitNegation(fragment: any)

Split a stored condition fragment into its negation flag and the positive fragment inside it, so the value editor only ever deals with the positive form regardless of whether the condition is negated.

Parameters :
Name Type Optional
fragment any No
withSameNegation
withSameNegation(previous: any, positive: any)

Build the replacement for previous from a freshly built positive fragment, keeping whatever negation previous carried.

The editor rebuilds a row's fragment from its value on every edit, so without this the negation of an existing condition would be dropped as soon as its value changed.

Parameters :
Name Type Optional
previous any No
positive any No
Returns : any

src/app/core/common-components/parsed-file-input/parsed-file-input.component.ts

normalizeCellValue
normalizeCellValue(value)

Unwraps exceljs's rich cell value shapes (e.g. hyperlinks expose text, formulas expose result) into a primitive suitable for the import flow.

Parameters :
Name Optional
value No
Returns : unknown

src/app/core/basic-datatypes/entity/entity.datatype.ts

normalizeEntityAdditional
normalizeEntityAdditional(additional)

Normalizes the additional config of an entity reference column mapping. Accepts legacy string format or new object format.

Parameters :
Name Optional
additional No
normalizeValue
normalizeValue(val: any)

Normalizes a value for comparison, converting it to a standardized string format. Ensures both numbers and strings are treated consistently.

Parameters :
Name Type Optional Description
val any No

The value to normalize.

Returns : string

The normalized value as a string.

src/app/core/export/data-transformation-service/export-column-config.ts

normalizeQueryKey
normalizeQueryKey(query: string)

Normalize a query key used in export column configs. Strips a leading dot if present so callers can compare logical field keys.

Parameters :
Name Type Optional
query string No
Returns : string

src/app/core/session/session-utils.ts

parseJwt
parseJwt(token: unknown)

Parses and returns the payload of a JWT into a JSON object. For me info see ://jwt.iohttps.

Parameters :
Name Type Optional Description
token unknown No

a valid JWT

Returns : ParsedJWT

src/app/core/basic-datatypes/string/pattern.validator.ts

patternWithMessage
patternWithMessage(pattern, message: string)

creates a pattern validator that also carries a predefined message

Parameters :
Name Type Optional
pattern No
message string No
Returns : ValidatorFn

src/app/utils/performance-analysis-logging.ts

PerformanceAnalysisLogging
PerformanceAnalysisLogging(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor)

Extend any class method to measure the duration it takes to finish and log it to the console.

Parameters :
Name Type Optional
target Object No
propertyKey string No
descriptor TypedPropertyDescriptor No

src/app/core/config/config.app-initializer.ts

preloadDynamicComponents
preloadDynamicComponents(registry: ComponentRegistry, destroyRef: DestroyRef)
Parameters :
Name Type Optional
registry ComponentRegistry No
destroyRef DestroyRef No

src/app/utils/retry-on-server-error.rxjs-pipe.ts

random
random(min: number, max: number)
Parameters :
Name Type Optional
min number No
max number No
retryOnServerError
retryOnServerError<T>(maxRetries: number)
Type parameters :
  • T

Retry an HttpClient request on server error (status code 5xx), whether the failure is an HttpErrorResponse or the typed error our backend's failures are converted into (see failedHttpResponse). Use this in pipe(retryOnServerError(2)).

Retries are done with exponential backoff delays that are randomized (in case there are many parallel requests to be spread out).

Parameters :
Name Type Optional
maxRetries number No
Returns : MonoTypeOperatorFunction<T>

src/app/core/entity/default-datatype/default.datatype.ts

referenceIdCondition
referenceIdCondition(path: string, referencedIds)

The Mango condition matching the given document path against any of the reference ids. It covers both shapes the value may have been stored in, the id itself or an array containing it, because $in also matches any element of an array (in CouchDB's _find as well as in pouchdb-find).

Parameters :
Name Type Optional
path string No
referencedIds No
Returns : DataFilter<any>

src/app/features/file/file-utils.ts

resizeImage
resizeImage(file: File, maxSize: number)
Parameters :
Name Type Optional Default value
file File No
maxSize number No 360
Returns : Promise<HTMLCanvasElement>

src/app/core/default-values/x-dynamic-placeholder/dynamic-placeholder-value.service.ts

resolveCondition
resolveCondition(condition, getValue: FieldValueGetter)

the rows of a condition that can be applied, with their placeholders resolved

Parameters :
Name Type Optional
condition No
getValue FieldValueGetter No
resolveConditionList
resolveConditionList(operator: string, conditions, getValue: FieldValueGetter)

The conditions of a list operator ($or, $and, $nor) of which at least one row can be applied (UNRESOLVED if none can). A condition that cannot be applied at all is left out of $and and $nor, which then restrict less. For $or it would restrict more, as the other alternatives would have to match instead: the whole $or is left out, because the alternative that cannot be applied does not restrict anything.

Parameters :
Name Type Optional
operator string No
conditions No
getValue FieldValueGetter No
resolveList
resolveList(list, getValue: FieldValueGetter)

a placeholder inside a list is replaced by all values of a multi-value field

Parameters :
Name Type Optional
list No
getValue FieldValueGetter No
Returns : unknown
resolveObject
resolveObject(value, getValue: FieldValueGetter)
Parameters :
Name Type Optional
value No
getValue FieldValueGetter No
Returns : unknown
resolveValue
resolveValue(value, getValue: FieldValueGetter)

the value with its placeholders resolved (UNRESOLVED if one of them references an empty field)

Parameters :
Name Type Optional
value No
getValue FieldValueGetter No
Returns : unknown

src/app/core/entity/schema/entity-schema.service.ts

resolveTranslatableLabels
resolveTranslatableLabels(field: FormFieldConfig)

Config loaded through ConfigService is already resolved, but the runtime schema can hold a translation map while an admin has configured translations that are not saved to the config document yet.

Exported for the few components that display a field config without extending it from a schema first (see addSchemaToFormField).

Parameters :
Name Type Optional
field FormFieldConfig No

src/app/utils/resourceWithRetention.ts

resourceWithRetention
resourceWithRetention<T, R>(options: ResourceOptions)
Type parameters :
  • T
  • R

Creates a resource that retains its previous value when reloading.

This function is similar to resource except while reloading. When isLoading() is true, value() holds the previously loaded value instead of undefined or defaultValue.

Parameters :
Name Type Optional
options ResourceOptions No
Returns : ResourceRef<T | undefined>

src/app/core/filter/not-archived-filter.ts

restrictToNotArchived
restrictToNotArchived<T extends Entity>(filter?: DataFilter)
Type parameters :
  • T extends Entity

Restrict the given filter to records that are not archived.

Parameters :
Name Type Optional
filter DataFilter Yes
Returns : DataFilter<T>

src/app/utils/reuse-first-async.ts

reuseFirstAsync
reuseFirstAsync<T>(fn)
Type parameters :
  • T

Wraps a function to ensure only one async operation runs at a time.

If called while the first async operation is still pending, returns the same promise. Once the operation completes (success or failure), subsequent calls will start a new operation.

Parameters :
Name Optional
fn No
Returns : Promise<T>

src/app/core/basic-datatypes/configurable-enum/configurable-enum.service.ts

sameOptions
sameOptions(a, b)
Parameters :
Name Optional
a No
b No
Returns : boolean

src/app/core/entity/entity-field-edit/dynamic-edit/edit-component-test-utils.ts

setupCustomFormControlEditComponent
setupCustomFormControlEditComponent<T>(component: CustomFormControlDirective, propertyName: string, schema: any, fixture?: ComponentFixture)
Type parameters :
  • T

Helper function for modern Angular components that extend CustomFormControlDirective.

Pass the fixture parameter for components that use signal input() for formFieldConfig, as direct property assignment does not work with signal inputs.

Parameters :
Name Type Optional Default value Description
component CustomFormControlDirective No

that extends CustomFormControlDirective

propertyName string No "testProperty"

(optional) the name of the property for which the edit component is created

schema any No {}

(optional) additional schema information for the entity field

fixture ComponentFixture Yes

(optional) required for components using signal input() for formFieldConfig

Returns : UntypedFormGroup

src/app/core/import/additional-actions/import-additional/import-additional-actions.component.ts

sortExportOnlyLast
sortExportOnlyLast(a: AdditionalImportAction, b: AdditionalImportAction)
Parameters :
Name Type Optional
a AdditionalImportAction No
b AdditionalImportAction No

src/app/core/import/split-array-value.ts

splitArrayValue
splitArrayValue(val: any, separator: string)

Split a raw value into an array of individual values. Supports JSON arrays and separator-delimited strings.

Parameters :
Name Type Optional Default value Description
val any No

The raw value to split

separator string No ","

The separator character to use for splitting (default: ",")

Returns : string[]

Array of individual string values

src/app/child-dev-project/notes/dashboard-widgets/notes-dashboard/notes-dashboard.component.ts

statsToEntityWithRecentNoteInfo
statsToEntityWithRecentNoteInfo(stat, queryRange: number)

Map a result entry from getDaysSinceLastNoteOfEachEntity to the EntityWithRecentNoteInfo interface

Parameters :
Name Type Optional Description
stat No

Array of [entityId, daysSinceLastNote]

queryRange number No

The query range (the maximum of days that exactly calculated)

src/app/features/attendance/analysis/attendance-calendar/attendance-calendar.component.ts

statusClass
statusClass(statusId: string)

CSS class of a calendar day on which the highlighted participant had this attendance status

Parameters :
Name Type Optional
statusId string No
Returns : string

src/app/core/entity/entity-special-loader/entity-special-loader.service.ts

supportsPagination
supportsPagination(loaderMethod?: LoaderMethod)

Whether this loader can serve one page at a time.

The others load everything they have in a single call, so a list using them has to page in memory. A plain function so the data-source resolver can ask without injecting the service.

Parameters :
Name Type Optional
loaderMethod LoaderMethod Yes
Returns : boolean

src/app/core/entity/schema/entity-schema.service.test-utils.ts

testDatatype
testDatatype<D extends DefaultDatatype>(dataType, objectValue: unknown, databaseValue: unknown, additionalSchemaFieldConfig?: any, additionalProviders?)
Type parameters :
  • D extends DefaultDatatype
Parameters :
Name Type Optional
dataType No
objectValue unknown No
databaseValue unknown No
additionalSchemaFieldConfig any Yes
additionalProviders Yes

src/app/core/entity/model/entity.test-utils.ts

testEntitySubclass
testEntitySubclass(entityType: string, entityClass: EntityConstructor, expectedDatabaseFormat: any, skipTestbedConfiguration: unknown, additionalProviders)

Shared entity subclass test cases for model classes extending Entity.

Parameters :
Name Type Optional Default value Description
entityType string No
entityClass EntityConstructor No
expectedDatabaseFormat any No
skipTestbedConfiguration unknown No false
additionalProviders No []

the datatypes (and their dependencies) used by the entity's schema. Provide the individual DefaultDatatype implementations rather than a module, so the spec does not boot the whole AppModule - see #4192.

src/app/core/export/export-value.ts

toExportValue
toExportValue(value: any)

Convert a value to a CSV/XLSX-friendly primitive, applying the same readable transformations as the UI (dates as YYYY-MM-DD, enum labels, location strings).

Parameters :
Name Type Optional
value any No
Returns : any

src/app/core/common-components/entity-form/FormConfig.ts

toFormFieldConfig
toFormFieldConfig(column: ColumnConfig)
Parameters :
Name Type Optional
column ColumnConfig No
Returns : FormFieldConfig

src/app/core/language/TranslatableMatPaginator.ts

TranslatableMatPaginator
TranslatableMatPaginator()

src/app/core/session/session-states/session-utils.ts

waitForChangeTo
waitForChangeTo<State>(state: State)
Type parameters :
  • State

Waits until the state of a source observable is equal to the given state, then emit that state. All other states are discarded.
After the state has changed to the desired state, subsequent states are let through. if this desire is not intended, use the filter function

Parameters :
Name Type Optional Description
state State No

The state to wait on otherwise continues to emit values from the source observable

Returns : MonoTypeOperatorFunction<State>

src/app/features/notification/firebase-messaging-service-worker.ts

waitUntilActive
waitUntilActive(registration: ServiceWorkerRegistration)
Parameters :
Name Type Optional
registration ServiceWorkerRegistration No

src/app/core/permissions/ability/entity-ability.ts

withEvaluableConditions
withEvaluableConditions(rule: RawRuleFrom)

Drop rules whose conditions the matcher cannot compile, e.g. { $or: [] }, which the raw JSON editor or a direct database edit can introduce. Such a rule throws on every permission check for its subject - and because CASL evaluates rules in order, one broken rule also takes down the valid rules next to it.

Validating by compiling with the very matcher that later evaluates the rule keeps the two from drifting apart as the operator set changes.

A granting rule is removed, which preserves the deny-by-default outcome such a config already had while the logical operators were unregistered. An inverted rule is kept without its conditions instead, since removing it would lift a restriction.

Parameters :
Name Type Optional
rule RawRuleFrom No
Returns : RawRuleFrom[]

src/app/core/export/download-service/download.service.ts

withExtension
withExtension(filename: string, extension: string)
Parameters :
Name Type Optional
filename string No
extension string No
Returns : string

src/app/core/basic-datatypes/date-range/within-parent-validator.ts

withinParentValidator
withinParentValidator(config: WithinParentConfig, fieldId: string, record, entityMapper: EntityMapperService)

Validator for a date range that should lie within the range of the parent record(s) it links to. Its error is only a warning (see WithinParentValidator.warning): the record can still be saved after confirming it. The parent link is taken from the form, or from the saved record if the form has no field for it.

Parameters :
Name Type Optional
config WithinParentConfig No
fieldId string No
record No
entityMapper EntityMapperService No

results matching ""

    No results matching ""