Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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): EventConfig

Parameters

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

On NOTIFY, DECLARE, REGISTER, ARCHIVE and REJECT, the optional form key is an array of fields shown on the action's confirmation dialog — not the declaration form. The declaration form belongs in declaration. See Core actions.

Last updated