@opencrvs/toolkit 2.0.0-rc.e6d7626 → 2.0.0-rc.e740cb5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/create-countryconfig/index.js +50 -20
  2. package/create-countryconfig/package.json +12 -2
  3. package/dist/application-config/index.js +252 -98
  4. package/dist/cli.js +98 -7
  5. package/dist/commons/api/router.d.ts +441 -48
  6. package/dist/commons/application-config/index.d.ts +1 -0
  7. package/dist/commons/conditionals/conditionals.d.ts +354 -4
  8. package/dist/commons/conditionals/validate.d.ts +51 -2
  9. package/dist/commons/events/ActionDocument.d.ts +6 -0
  10. package/dist/commons/events/ActionInput.d.ts +42 -36
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  12. package/dist/commons/events/Draft.d.ts +2 -3
  13. package/dist/commons/events/EventDocument.d.ts +3 -0
  14. package/dist/commons/events/EventIndex.d.ts +0 -3
  15. package/dist/commons/events/EventMetadata.d.ts +0 -7
  16. package/dist/commons/events/FieldConfig.d.ts +377 -50
  17. package/dist/commons/events/FieldValue.d.ts +6 -0
  18. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  19. package/dist/commons/events/field.d.ts +53 -1
  20. package/dist/commons/events/index.d.ts +2 -0
  21. package/dist/commons/events/state/flags.d.ts +16 -0
  22. package/dist/commons/events/state/index.d.ts +0 -4
  23. package/dist/commons/events/state/utils.d.ts +12 -289
  24. package/dist/commons/events/utils.d.ts +12 -1
  25. package/dist/conditionals/index.js +55 -2
  26. package/dist/events/index.js +921 -221
  27. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  28. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  29. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  30. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/index.js +96 -5
  32. package/dist/notification/index.js +790 -134
  33. package/dist/scopes/index.js +3 -1
  34. package/opencrvs-toolkit-2.0.0-rc.e740cb5.tgz +0 -0
  35. package/package.json +6 -2
  36. package/tsconfig.tsbuildinfo +1 -1
  37. package/opencrvs-toolkit-2.0.0-rc.e6d7626.tgz +0 -0
@@ -75,7 +75,10 @@ var ActionConditional = z.discriminatedUnion("type", [
75
75
  ShowConditional,
76
76
  // Action can be shown to the user in the list but as disabled
77
77
  EnableConditional
78
- ]);
78
+ ]).meta({
79
+ id: "ActionConditional",
80
+ description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
81
+ });
79
82
  var DisplayOnReviewConditional = z.object({
80
83
  type: z.literal(ConditionalType.DISPLAY_ON_REVIEW),
81
84
  conditional: Conditional
@@ -90,8 +93,8 @@ var FieldConditional = z.discriminatedUnion("type", [
90
93
  // Field output can be shown / hidden on the review page
91
94
  DisplayOnReviewConditional
92
95
  ]).meta({
93
- description: "Field conditional configuration",
94
- id: "FieldConditional"
96
+ id: "FieldConditional",
97
+ description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
95
98
  });
96
99
 
97
100
  // ../commons/src/events/TranslationConfig.ts
@@ -350,6 +353,7 @@ var DateRangeFieldValue = z7.object({
350
353
  var EmailValue = z7.email();
351
354
  var CheckboxFieldValue = z7.boolean();
352
355
  var NumberFieldValue = z7.number();
356
+ var SignatureFieldValue = FileFieldValue;
353
357
  var ButtonFieldValue = z7.number();
354
358
  var VerificationStatusValue = z7.enum([
355
359
  "verified",
@@ -831,7 +835,9 @@ var ScopeType = z11.enum([
831
835
  var EncodedScope = z11.string().brand("EncodedScope");
832
836
  var DEFAULT_SCOPE_OPTIONS = {
833
837
  placeOfEvent: JurisdictionFilter.enum.all,
834
- accessLevel: JurisdictionFilter.enum.all
838
+ accessLevel: JurisdictionFilter.enum.all,
839
+ registeredIn: JurisdictionFilter.enum.all,
840
+ declaredIn: JurisdictionFilter.enum.all
835
841
  };
836
842
 
837
843
  // ../commons/src/authentication.ts
@@ -984,8 +990,9 @@ var RequestedCorrectionAction = ActionBase.extend(
984
990
  var ApprovedCorrectionAction = ActionBase.extend(
985
991
  z13.object({
986
992
  type: z13.literal(ActionType.APPROVE_CORRECTION),
987
- requestId: z13.string()
993
+ requestId: z13.string(),
988
994
  // TODO move into 'content' property
995
+ content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
989
996
  }).shape
990
997
  );
991
998
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1077,6 +1084,9 @@ var FlagConfig = z14.object({
1077
1084
  "Indicates if this flag expects an action to be performed to be cleared."
1078
1085
  ),
1079
1086
  label: TranslationConfig.describe("Human readable label of the flag.")
1087
+ }).meta({
1088
+ id: "FlagConfig",
1089
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1080
1090
  });
1081
1091
  var ActionFlagConfig = z14.object({
1082
1092
  id: Flag,
@@ -1084,6 +1094,9 @@ var ActionFlagConfig = z14.object({
1084
1094
  conditional: Conditional.optional().describe(
1085
1095
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1086
1096
  )
1097
+ }).meta({
1098
+ id: "ActionFlagConfig",
1099
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1087
1100
  });
1088
1101
 
1089
1102
  // ../commons/src/events/EventMetadata.ts
@@ -1105,8 +1118,7 @@ var ActionCreationMetadata = z15.object({
1105
1118
  ),
1106
1119
  createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1107
1120
  acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
1108
- createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation."),
1109
- createdBySignature: z15.string().nullish().describe("Signature of the user who created the action request.")
1121
+ createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
1110
1122
  });
1111
1123
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1112
1124
  registrationNumber: z15.string().describe(
@@ -1134,9 +1146,6 @@ var EventMetadata = z15.object({
1134
1146
  createdAtLocation: UUID.nullish().describe(
1135
1147
  "Location of the user who created the event."
1136
1148
  ),
1137
- createdBySignature: DocumentPath.nullish().describe(
1138
- "Signature of the user who created the event."
1139
- ),
1140
1149
  updatedAtLocation: UUID.nullish().describe(
1141
1150
  "Location of the user who last changed the status."
1142
1151
  ),
@@ -1400,14 +1409,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1400
1409
  }
1401
1410
  }).describe("Unique identifier for the field");
1402
1411
  var FieldReference = import_v43.default.object({
1403
- $$field: FieldId,
1412
+ $$field: FieldId.describe("Id of the field to reference"),
1404
1413
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1405
1414
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1415
+ ),
1416
+ $$code: import_v43.default.string().optional().describe(
1417
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1418
+ )
1419
+ }).describe(
1420
+ "Reference to a field value, with an optional client-side computation applied."
1421
+ );
1422
+ var ComputedDefaultValue = import_v43.default.object({
1423
+ $$code: import_v43.default.string().describe(
1424
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1406
1425
  )
1407
- }).describe("Reference to a field by its ID");
1426
+ }).describe("A context-only computation used as a field default value.");
1408
1427
  var ValidationConfig = import_v43.default.object({
1409
- validator: Conditional,
1410
- message: TranslationConfig
1428
+ validator: Conditional.describe(
1429
+ "Conditional expression that must hold for the field value to be considered valid."
1430
+ ),
1431
+ message: TranslationConfig.describe(
1432
+ "Error message displayed when the validator does not hold."
1433
+ )
1434
+ }).meta({
1435
+ id: "ValidationConfig",
1436
+ description: "Validation rule applied to a form field. The validator is a conditional expression that must hold for the field value to be considered valid."
1411
1437
  });
1412
1438
  var requiredSchema = import_v43.default.union([
1413
1439
  import_v43.default.boolean(),
@@ -1438,7 +1464,7 @@ var BaseField = import_v43.default.object({
1438
1464
  "Indicates whether the field can be modified during record correction."
1439
1465
  ),
1440
1466
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1441
- "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
1467
+ "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used. A FieldReference with $$code computes the value via a custom client-side function."
1442
1468
  ),
1443
1469
  analytics: import_v43.default.boolean().default(false).optional().describe(
1444
1470
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1446,30 +1472,39 @@ var BaseField = import_v43.default.object({
1446
1472
  }).describe("Common properties shared across all field types.");
1447
1473
  var Divider = BaseField.extend({
1448
1474
  type: import_v43.default.literal(FieldType.DIVIDER)
1475
+ }).meta({
1476
+ description: "A horizontal line divider",
1477
+ id: "Divider"
1449
1478
  });
1450
1479
  var TextField = BaseField.extend({
1451
1480
  type: import_v43.default.literal(FieldType.TEXT),
1452
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1481
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1453
1482
  configuration: import_v43.default.object({
1454
1483
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1455
1484
  type: import_v43.default.enum(["text", "password"]).optional(),
1456
1485
  prefix: TranslationConfig.optional(),
1457
1486
  postfix: TranslationConfig.optional()
1458
1487
  }).default({ type: "text" }).optional()
1459
- }).describe("Text input");
1488
+ }).meta({
1489
+ description: "A text input field",
1490
+ id: "TextField"
1491
+ });
1460
1492
  var NumberField = BaseField.extend({
1461
1493
  type: import_v43.default.literal(FieldType.NUMBER),
1462
- defaultValue: NumberFieldValue.optional(),
1494
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1463
1495
  configuration: import_v43.default.object({
1464
1496
  min: import_v43.default.number().optional().describe("Minimum value"),
1465
1497
  max: import_v43.default.number().optional().describe("Maximum value"),
1466
1498
  prefix: TranslationConfig.optional(),
1467
1499
  postfix: TranslationConfig.optional()
1468
1500
  }).optional()
1469
- }).describe("Number input");
1501
+ }).meta({
1502
+ description: "A number input field",
1503
+ id: "NumberField"
1504
+ });
1470
1505
  var TextAreaField = BaseField.extend({
1471
1506
  type: import_v43.default.literal(FieldType.TEXTAREA),
1472
- defaultValue: NonEmptyTextValue.optional(),
1507
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1473
1508
  configuration: import_v43.default.object({
1474
1509
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1475
1510
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1477,7 +1512,10 @@ var TextAreaField = BaseField.extend({
1477
1512
  prefix: TranslationConfig.optional(),
1478
1513
  postfix: TranslationConfig.optional()
1479
1514
  }).default({ rows: 4 }).optional()
1480
- }).describe("Multiline text input");
1515
+ }).meta({
1516
+ description: "A multiline text input",
1517
+ id: "TextAreaField"
1518
+ });
1481
1519
  var ImageMimeType = import_v43.default.enum([
1482
1520
  "image/png",
1483
1521
  "image/jpg",
@@ -1500,58 +1538,76 @@ var SignatureField = BaseField.extend({
1500
1538
  signaturePromptLabel: TranslationConfig.describe(
1501
1539
  "Title of the signature modal"
1502
1540
  ),
1503
- defaultValue: FieldValue.optional(),
1541
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1504
1542
  configuration: import_v43.default.object({
1505
1543
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1506
1544
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1507
1545
  }).default({
1508
1546
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1509
1547
  })
1510
- }).describe("Signature input field");
1548
+ }).meta({
1549
+ description: "A signature input field",
1550
+ id: "SignatureField"
1551
+ });
1511
1552
  var EmailField = BaseField.extend({
1512
1553
  type: import_v43.default.literal(FieldType.EMAIL),
1513
1554
  configuration: import_v43.default.object({
1514
1555
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1515
1556
  }).default({ maxLength: 255 }).optional(),
1516
- defaultValue: NonEmptyTextValue.optional()
1557
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1558
+ }).meta({
1559
+ description: "An email input field",
1560
+ id: "EmailField"
1517
1561
  });
1518
1562
  var DateField = BaseField.extend({
1519
1563
  type: import_v43.default.literal(FieldType.DATE),
1520
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1564
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1521
1565
  configuration: import_v43.default.object({
1522
1566
  notice: TranslationConfig.describe(
1523
1567
  "Text to display above the date input"
1524
1568
  ).optional()
1525
1569
  }).optional()
1526
- }).describe("A single date input (yyyy-MM-dd)");
1570
+ }).meta({
1571
+ description: "A date input (yyyy-MM-dd)",
1572
+ id: "DateField"
1573
+ });
1527
1574
  var AgeField = BaseField.extend({
1528
1575
  type: import_v43.default.literal(FieldType.AGE),
1529
- defaultValue: NumberFieldValue.optional(),
1576
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1530
1577
  configuration: import_v43.default.object({
1531
1578
  asOfDate: FieldReference,
1532
1579
  prefix: TranslationConfig.optional(),
1533
1580
  postfix: TranslationConfig.optional()
1534
1581
  })
1535
- }).describe("An age input field which uses the current date as the asOfDate");
1582
+ }).meta({
1583
+ description: "An age input field which uses the current date as the asOfDate",
1584
+ id: "AgeField"
1585
+ });
1536
1586
  var TimeField = BaseField.extend({
1537
1587
  type: import_v43.default.literal(FieldType.TIME),
1538
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1588
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1539
1589
  configuration: import_v43.default.object({
1540
1590
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1541
1591
  notice: TranslationConfig.describe(
1542
1592
  "Text to display above the time input"
1543
1593
  ).optional()
1544
1594
  }).optional()
1545
- }).describe("A single date input (HH-mm)");
1595
+ }).meta({
1596
+ description: "A single time input (HH-mm)",
1597
+ id: "TimeField"
1598
+ });
1546
1599
  var DateRangeField = BaseField.extend({
1547
1600
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1548
- defaultValue: DateRangeFieldValue.optional(),
1601
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1549
1602
  configuration: import_v43.default.object({
1550
1603
  notice: TranslationConfig.describe(
1551
1604
  "Text to display above the date input"
1552
1605
  ).optional()
1553
1606
  }).optional()
1554
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1607
+ }).meta({
1608
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1609
+ id: "DateRangeField"
1610
+ });
1555
1611
  var HtmlFontVariant = import_v43.default.enum([
1556
1612
  "reg12",
1557
1613
  "reg14",
@@ -1595,21 +1651,33 @@ var ImageViewField = BaseField.extend({
1595
1651
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1596
1652
  defaultValue: NonEmptyTextValue.optional(),
1597
1653
  configuration: ImageConfiguration
1598
- }).describe("A read-only image component for form pages");
1654
+ }).meta({
1655
+ description: "A read-only image component for form pages",
1656
+ id: "ImageViewField"
1657
+ });
1599
1658
  var Paragraph = BaseField.extend({
1600
1659
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1601
1660
  configuration: ParagraphConfiguration
1602
- }).describe("A read-only HTML <p> paragraph");
1661
+ }).meta({
1662
+ description: "A read-only HTML <p> paragraph",
1663
+ id: "Paragraph"
1664
+ });
1603
1665
  var Heading = BaseField.extend({
1604
1666
  type: import_v43.default.literal(FieldType.HEADING),
1605
1667
  configuration: HeadingConfiguration
1606
- }).describe("A read-only heading component for form pages");
1668
+ }).meta({
1669
+ description: "A read-only heading component for form pages",
1670
+ id: "Heading"
1671
+ });
1607
1672
  var PageHeader = BaseField.extend({
1608
1673
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1609
- }).describe("A read-only header component for form pages");
1674
+ }).meta({
1675
+ description: "A read-only header component for form pages",
1676
+ id: "PageHeader"
1677
+ });
1610
1678
  var File = BaseField.extend({
1611
1679
  type: import_v43.default.literal(FieldType.FILE),
1612
- defaultValue: FileFieldValue.optional(),
1680
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1613
1681
  configuration: import_v43.default.object({
1614
1682
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1615
1683
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1625,7 +1693,10 @@ var File = BaseField.extend({
1625
1693
  }).default({
1626
1694
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1627
1695
  })
1628
- }).describe("File upload");
1696
+ }).meta({
1697
+ description: "A file upload field",
1698
+ id: "File"
1699
+ });
1629
1700
  var SelectOption = import_v43.default.object({
1630
1701
  value: import_v43.default.string().describe("The value of the option"),
1631
1702
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1633,7 +1704,7 @@ var SelectOption = import_v43.default.object({
1633
1704
  });
1634
1705
  var NumberWithUnitField = BaseField.extend({
1635
1706
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1636
- defaultValue: NumberWithUnitFieldValue.optional(),
1707
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1637
1708
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1638
1709
  configuration: import_v43.default.object({
1639
1710
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1642,17 +1713,23 @@ var NumberWithUnitField = BaseField.extend({
1642
1713
  "Placeholder for the number field"
1643
1714
  )
1644
1715
  }).optional()
1645
- }).describe("Number with unit input");
1716
+ }).meta({
1717
+ description: "A number with unit input field",
1718
+ id: "NumberWithUnitField"
1719
+ });
1646
1720
  var RadioGroup = BaseField.extend({
1647
1721
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1648
- defaultValue: TextValue.optional(),
1722
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1649
1723
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1650
1724
  configuration: import_v43.default.object({
1651
1725
  styles: import_v43.default.object({
1652
1726
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1653
1727
  }).optional()
1654
1728
  }).optional()
1655
- }).describe("Grouped radio options");
1729
+ }).meta({
1730
+ description: "A grouped radio button field",
1731
+ id: "RadioGroup"
1732
+ });
1656
1733
  var BulletList = BaseField.extend({
1657
1734
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1658
1735
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1661,10 +1738,13 @@ var BulletList = BaseField.extend({
1661
1738
  fontVariant: HtmlFontVariant.optional()
1662
1739
  }).optional()
1663
1740
  }).default({})
1664
- }).describe("A list of bullet points");
1741
+ }).meta({
1742
+ description: "A list of bullet points",
1743
+ id: "BulletList"
1744
+ });
1665
1745
  var Select = BaseField.extend({
1666
1746
  type: import_v43.default.literal(FieldType.SELECT),
1667
- defaultValue: TextValue.optional(),
1747
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1668
1748
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1669
1749
  noOptionsMessage: TranslationConfig.optional().describe(
1670
1750
  `
@@ -1676,16 +1756,22 @@ var Select = BaseField.extend({
1676
1756
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1677
1757
  `
1678
1758
  )
1679
- }).describe("Select input");
1759
+ }).meta({
1760
+ description: "A select input field",
1761
+ id: "Select"
1762
+ });
1680
1763
  var SelectDateRangeOption = import_v43.default.object({
1681
1764
  value: SelectDateRangeValue.describe("The value of the option"),
1682
1765
  label: TranslationConfig.describe("The label of the option")
1683
1766
  });
1684
1767
  var SelectDateRangeField = BaseField.extend({
1685
1768
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1686
- defaultValue: SelectDateRangeValue.optional(),
1769
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1687
1770
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1688
- }).describe("Select input with date range options");
1771
+ }).meta({
1772
+ description: "A date range selection field",
1773
+ id: "SelectDateRangeField"
1774
+ });
1689
1775
  var NameConfig = import_v43.default.object({
1690
1776
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1691
1777
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1697,7 +1783,7 @@ var NameField = BaseField.extend({
1697
1783
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1698
1784
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1699
1785
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1700
- }).optional(),
1786
+ }).or(ComputedDefaultValue).optional(),
1701
1787
  configuration: import_v43.default.object({
1702
1788
  name: NameConfig.default({
1703
1789
  firstname: { required: true },
@@ -1716,26 +1802,41 @@ var NameField = BaseField.extend({
1716
1802
  surname: { required: true }
1717
1803
  }
1718
1804
  }).optional()
1719
- }).describe("Name input field");
1805
+ }).meta({
1806
+ description: "A field for entering a persons name",
1807
+ id: "NameField"
1808
+ });
1720
1809
  var PhoneField = BaseField.extend({
1721
- defaultValue: NonEmptyTextValue.optional(),
1810
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1722
1811
  type: import_v43.default.literal(FieldType.PHONE)
1723
- }).describe("Phone input field");
1812
+ }).meta({
1813
+ description: "A field for entering a phone number",
1814
+ id: "PhoneField"
1815
+ });
1724
1816
  var IdField = BaseField.extend({
1725
- defaultValue: NonEmptyTextValue.optional(),
1817
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1726
1818
  type: import_v43.default.literal(FieldType.ID)
1727
- }).describe("ID input field");
1819
+ }).meta({
1820
+ description: "A field for entering an ID",
1821
+ id: "IdField"
1822
+ });
1728
1823
  var Checkbox = BaseField.extend({
1729
1824
  type: import_v43.default.literal(FieldType.CHECKBOX),
1730
- defaultValue: CheckboxFieldValue.default(false)
1731
- }).describe("Boolean checkbox field");
1825
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
1826
+ }).meta({
1827
+ description: "A boolean checkbox field",
1828
+ id: "Checkbox"
1829
+ });
1732
1830
  var Country = BaseField.extend({
1733
1831
  type: import_v43.default.literal(FieldType.COUNTRY),
1734
- defaultValue: NonEmptyTextValue.optional(),
1832
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1735
1833
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1736
1834
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1737
1835
  )
1738
- }).describe("Country select field");
1836
+ }).meta({
1837
+ description: "A field for selecting a country",
1838
+ id: "Country"
1839
+ });
1739
1840
  var AllowedLocations = JurisdictionReference.optional().describe(
1740
1841
  "Limits which location options are selectable depending on user jurisdiction and location."
1741
1842
  );
@@ -1744,28 +1845,33 @@ var AdministrativeAreas = import_v43.default.enum([
1744
1845
  "HEALTH_FACILITY",
1745
1846
  "CRVS_OFFICE"
1746
1847
  ]);
1747
- var AdministrativeAreaConfiguration = import_v43.default.object({
1748
- partOf: FieldReference.optional().describe("Parent location"),
1749
- type: AdministrativeAreas,
1750
- allowedLocations: AllowedLocations
1751
- }).describe("Administrative area options");
1752
1848
  var AdministrativeAreaField = BaseField.extend({
1753
1849
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1754
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1755
- configuration: AdministrativeAreaConfiguration
1756
- }).describe("Administrative area input field e.g. facility, office");
1850
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1851
+ configuration: import_v43.default.object({
1852
+ partOf: FieldReference.optional().describe("Parent location"),
1853
+ type: AdministrativeAreas,
1854
+ allowedLocations: AllowedLocations
1855
+ }).describe("Administrative area options")
1856
+ }).meta({
1857
+ description: "Administrative area input field",
1858
+ id: "AdministrativeAreaField"
1859
+ });
1757
1860
  var LocationInput = BaseField.extend({
1758
1861
  type: import_v43.default.literal(FieldType.LOCATION),
1759
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1862
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1760
1863
  configuration: import_v43.default.object({
1761
1864
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1762
1865
  allowedLocations: AllowedLocations
1763
1866
  }).optional()
1764
- }).describe("Input field for a location");
1867
+ }).meta({
1868
+ description: "A field for selecting a location",
1869
+ id: "LocationInput"
1870
+ });
1765
1871
  var FileUploadWithOptions = BaseField.extend({
1766
1872
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
1767
1873
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1768
- defaultValue: FileFieldWithOptionValue.optional(),
1874
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
1769
1875
  configuration: import_v43.default.object({
1770
1876
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1771
1877
  maxImageSize: import_v43.default.object({
@@ -1775,15 +1881,18 @@ var FileUploadWithOptions = BaseField.extend({
1775
1881
  }).default({
1776
1882
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1777
1883
  })
1884
+ }).meta({
1885
+ description: "A field for uploading files with file type options",
1886
+ id: "FileUploadWithOptions"
1778
1887
  });
1779
1888
  var Facility = BaseField.extend({
1780
1889
  type: import_v43.default.literal(FieldType.FACILITY),
1781
- defaultValue: NonEmptyTextValue.optional(),
1890
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1782
1891
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1783
1892
  }).describe("Input field for a facility");
1784
1893
  var Office = BaseField.extend({
1785
1894
  type: import_v43.default.literal(FieldType.OFFICE),
1786
- defaultValue: NonEmptyTextValue.optional(),
1895
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1787
1896
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1788
1897
  }).describe("Input field for an office");
1789
1898
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -1819,8 +1928,11 @@ var Address = BaseField.extend({
1819
1928
  ).optional(),
1820
1929
  allowedLocations: AllowedLocations
1821
1930
  }).optional(),
1822
- defaultValue: DefaultAddressFieldValue.optional()
1823
- }).describe("Address input field \u2013 a combination of location and text fields");
1931
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
1932
+ }).meta({
1933
+ description: "Address input field \u2013 a combination of location and text fields",
1934
+ id: "Address"
1935
+ });
1824
1936
  var StaticDataEntry = import_v43.default.object({
1825
1937
  id: import_v43.default.string().describe("ID for the data entry."),
1826
1938
  label: TranslationConfig,
@@ -1835,7 +1947,10 @@ var DataField = BaseField.extend({
1835
1947
  subtitle: TranslationConfig.optional(),
1836
1948
  data: import_v43.default.array(DataEntry)
1837
1949
  })
1838
- }).describe("Data field for displaying read-only data");
1950
+ }).meta({
1951
+ description: "A field for displaying a table of read-only data",
1952
+ id: "DataField"
1953
+ });
1839
1954
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
1840
1955
  var ButtonType = import_v43.default.enum([
1841
1956
  "primary",
@@ -1860,13 +1975,19 @@ var ButtonConfiguration = import_v43.default.object({
1860
1975
  });
1861
1976
  var ButtonField = BaseField.extend({
1862
1977
  type: import_v43.default.literal(FieldType.BUTTON),
1863
- defaultValue: ButtonFieldValue.optional(),
1978
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
1864
1979
  configuration: ButtonConfiguration
1865
- }).describe("Generic button without any built-in functionality");
1980
+ }).meta({
1981
+ description: "A generic button that can be used to trigger an action",
1982
+ id: "ButtonField"
1983
+ });
1866
1984
  var FieldGroup = BaseField.extend({
1867
1985
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
1868
1986
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1869
1987
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
1988
+ }).meta({
1989
+ description: "A group of fields that are displayed together",
1990
+ id: "FieldGroup"
1870
1991
  });
1871
1992
  var AlphaPrintButton = BaseField.extend({
1872
1993
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -1876,10 +1997,13 @@ var AlphaPrintButton = BaseField.extend({
1876
1997
  "Label for the print button"
1877
1998
  )
1878
1999
  })
1879
- }).describe("Print button field for printing certificates");
2000
+ }).meta({
2001
+ description: "An experimental print button field for printing certificates during the declaration process",
2002
+ id: "AlphaPrintButton"
2003
+ });
1880
2004
  var HttpField = BaseField.extend({
1881
2005
  type: import_v43.default.literal(FieldType.HTTP),
1882
- defaultValue: HttpFieldValue.optional(),
2006
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
1883
2007
  configuration: import_v43.default.object({
1884
2008
  trigger: FieldReference.optional().describe(
1885
2009
  "Reference to the field that triggers the HTTP request when its value changes. If not provided, the HTTP request is triggered once on component mount."
@@ -1892,20 +2016,30 @@ var HttpField = BaseField.extend({
1892
2016
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
1893
2017
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
1894
2018
  })
1895
- }).describe("HTTP request function triggered by a button click or other event");
2019
+ }).meta({
2020
+ description: "Makes a background HTTP request to an external service and stores the response so other fields can use it. Has no visible UI \u2014 pair with LOADER to show request status.",
2021
+ id: "HttpField"
2022
+ });
1896
2023
  var AutocompleteField = BaseField.extend({
1897
2024
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
1898
2025
  configuration: import_v43.default.object({
1899
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2026
+ url: import_v43.default.string().describe(
2027
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2028
+ ).optional(),
1900
2029
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
1901
2030
  defaultOptions: import_v43.default.array(
1902
2031
  import_v43.default.object({
1903
2032
  label: import_v43.default.string(),
1904
2033
  value: import_v43.default.string()
1905
2034
  })
1906
- ).optional()
2035
+ ).optional().describe(
2036
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2037
+ )
1907
2038
  })
1908
- }).describe("Autocomplete input field");
2039
+ }).meta({
2040
+ description: "Generic autocomplete component designed for use with large dictionary-based datasets. The component supports dynamic retrieval of options from configurable data sources and is intended for datasets that may contain tens or hundreds of thousands of records.",
2041
+ id: "AutocompleteField"
2042
+ });
1909
2043
  var SearchField = HttpField.extend({
1910
2044
  type: import_v43.default.literal(FieldType.SEARCH),
1911
2045
  configuration: SearchQuery.pick({
@@ -1938,6 +2072,9 @@ var SearchField = HttpField.extend({
1938
2072
  ok: TranslationConfig.optional()
1939
2073
  }).optional()
1940
2074
  })
2075
+ }).meta({
2076
+ description: "A search input field",
2077
+ id: "SearchField"
1941
2078
  });
1942
2079
  var LinkButtonField = BaseField.extend({
1943
2080
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -1946,28 +2083,35 @@ var LinkButtonField = BaseField.extend({
1946
2083
  text: TranslationConfig.describe("Text to display on the button"),
1947
2084
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1948
2085
  })
1949
- }).describe("Button that opens a link");
2086
+ }).meta({
2087
+ description: "A button that opens a URL link",
2088
+ id: "LinkButtonField"
2089
+ });
1950
2090
  var VerificationStatus = BaseField.extend({
1951
2091
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
1952
- defaultValue: VerificationStatusValue.optional(),
2092
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
1953
2093
  configuration: import_v43.default.object({
1954
2094
  status: TranslationConfig.describe("Text to display on the status pill."),
1955
2095
  description: TranslationConfig.describe(
1956
2096
  "Explaining text on the banner in form."
1957
2097
  )
1958
2098
  })
2099
+ }).meta({
2100
+ description: "Displays a verification state (e.g. ID verified / pending). Often paired with ID_READER \u2014 it can read its value off an ID_READER rather than holding its own.",
2101
+ id: "VerificationStatus"
1959
2102
  });
1960
2103
  var QueryParamReaderField = BaseField.extend({
1961
2104
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
1962
2105
  configuration: import_v43.default.object({
1963
2106
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
1964
2107
  })
1965
- }).describe(
1966
- "A field that maps URL query params into form values and clears them afterward"
1967
- );
2108
+ }).meta({
2109
+ description: "A field that maps URL query params into form values and clears them afterward",
2110
+ id: "QueryParamReaderField"
2111
+ });
1968
2112
  var QrReaderField = BaseField.extend({
1969
2113
  type: import_v43.default.literal(FieldType.QR_READER),
1970
- defaultValue: QrReaderFieldValue.optional(),
2114
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
1971
2115
  configuration: import_v43.default.object({
1972
2116
  validator: import_v43.default.any().meta({
1973
2117
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -1975,21 +2119,27 @@ var QrReaderField = BaseField.extend({
1975
2119
  })
1976
2120
  }).optional()
1977
2121
  }).meta({
1978
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2122
+ description: "QR code reader field, including optional JSON Schema validator.",
1979
2123
  id: "QrReaderField"
1980
2124
  });
1981
2125
  var IdReaderField = BaseField.extend({
1982
2126
  type: import_v43.default.literal(FieldType.ID_READER),
1983
- defaultValue: IdReaderFieldValue.optional(),
2127
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
1984
2128
  methods: import_v43.default.array(
1985
2129
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1986
2130
  )
2131
+ }).meta({
2132
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2133
+ id: "IdReaderField"
1987
2134
  });
1988
2135
  var CustomField = BaseField.extend({
1989
2136
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
1990
2137
  defaultValue: CustomFieldValue.optional(),
1991
2138
  src: import_v43.default.string().describe("Module source path for the custom field component"),
1992
2139
  configuration: import_v43.default.unknown().optional()
2140
+ }).meta({
2141
+ description: "An expiremental custom field that is defined by a module source path",
2142
+ id: "CustomField"
1993
2143
  });
1994
2144
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
1995
2145
  var LoaderField = BaseField.extend({
@@ -1999,22 +2149,25 @@ var LoaderField = BaseField.extend({
1999
2149
  configuration: import_v43.default.object({
2000
2150
  text: TranslationConfig.describe("Display text above the loading spinner")
2001
2151
  })
2002
- }).describe(
2003
- "A non-interactive field that indicates an in progress operation in form"
2004
- );
2152
+ }).meta({
2153
+ description: "A non-interactive field that indicates an in progress operation in form",
2154
+ id: "LoaderField"
2155
+ });
2005
2156
  var HiddenField = BaseField.extend({
2006
2157
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2007
2158
  required: import_v43.default.boolean().default(false).optional(),
2008
2159
  defaultValue: TextValue.optional()
2009
- }).describe(
2010
- "A non-interactive, hidden field that only hold a value in the form"
2011
- );
2160
+ }).meta({
2161
+ description: "A non-interactive, hidden field that only hold a value in the form",
2162
+ id: "HiddenField"
2163
+ });
2012
2164
  var UserRoleField = BaseField.extend({
2013
2165
  type: import_v43.default.literal(FieldType.USER_ROLE),
2014
2166
  defaultValue: TextValue.optional()
2015
- }).describe(
2016
- "A select dropdown that is automatically populated with available user roles"
2017
- );
2167
+ }).meta({
2168
+ description: "A select dropdown that is automatically populated with available user roles",
2169
+ id: "UserRoleField"
2170
+ });
2018
2171
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2019
2172
  FieldGroup,
2020
2173
  Address,
@@ -2132,6 +2285,7 @@ var ClientConfig = z20.object({
2132
2285
  COUNTRY: z20.string(),
2133
2286
  LANGUAGES: z20.array(z20.string()),
2134
2287
  SENTRY: z20.string().optional(),
2288
+ LOGIN_URL: z20.string().optional(),
2135
2289
  REGISTER_BACKGROUND: BackgroundConfig,
2136
2290
  DASHBOARDS: z20.array(
2137
2291
  z20.object({