Configuration
defineConfig
Defines and validates a complete event type (birth, death, marriage, or any custom event). Parses and validates the config at startup; throws if the config is invalid.
Signature
function defineConfig(config: EventConfigInput): EventConfigParameters
Example 1 — marriage event
import { defineConfig, field, ActionType } from '@opencrvs/toolkit/events'
export const marriageEvent = defineConfig({
id: 'marriage',
label: { id: 'event.marriage.label', defaultMessage: 'Marriage', description: '' },
title: {
id: 'event.marriage.title',
defaultMessage: '{bride.name.firstname} & {groom.name.firstname}',
description: ''
},
fallbackTitle: { id: 'event.marriage.fallbackTitle', defaultMessage: 'No names provided', description: '' },
dateOfEvent: field('marriage.date'),
summary: { fields: [{ fieldId: 'marriage.date' }, { fieldId: 'marriage.placeOfMarriage' }] },
declaration: MARRIAGE_DECLARATION_FORM,
actions: [
{ type: ActionType.DECLARE, label: { id: 'event.marriage.declare', defaultMessage: 'Declare', description: '' }, review: MARRIAGE_REVIEW_FORM },
{ type: ActionType.REGISTER, label: { id: 'event.marriage.register', defaultMessage: 'Register', description: '' } }
]
})Example 2 — birth event with date/place references
Last updated