@opencrvs/toolkit 2.0.0-rc.d1ea58b → 2.0.0-rc.d23bb0b

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 (101) hide show
  1. package/README.md +14 -0
  2. package/build.sh +3 -2
  3. package/create-countryconfig/index.js +50 -20
  4. package/create-countryconfig/package.json +12 -2
  5. package/dist/application-config/index.js +257 -94
  6. package/dist/cli.js +3166 -45
  7. package/dist/commons/api/router.d.ts +109 -21
  8. package/dist/commons/application-config/index.d.ts +1 -0
  9. package/dist/commons/conditionals/conditionals.d.ts +354 -4
  10. package/dist/commons/conditionals/validate.d.ts +51 -2
  11. package/dist/commons/events/ActionConfig.d.ts +28 -2
  12. package/dist/commons/events/ActionDocument.d.ts +6 -0
  13. package/dist/commons/events/ActionInput.d.ts +42 -36
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
  16. package/dist/commons/events/Draft.d.ts +2 -3
  17. package/dist/commons/events/EventDocument.d.ts +3 -0
  18. package/dist/commons/events/EventIndex.d.ts +14 -0
  19. package/dist/commons/events/FieldConfig.d.ts +378 -50
  20. package/dist/commons/events/FieldType.d.ts +1 -0
  21. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  22. package/dist/commons/events/FieldValue.d.ts +6 -0
  23. package/dist/commons/events/WorkqueueConfig.d.ts +189 -150
  24. package/dist/commons/events/field.d.ts +53 -1
  25. package/dist/commons/events/index.d.ts +2 -0
  26. package/dist/commons/events/state/flags.d.ts +16 -0
  27. package/dist/commons/events/state/utils.d.ts +12 -287
  28. package/dist/commons/events/utils.d.ts +12 -1
  29. package/dist/conditionals/index.js +52 -1
  30. package/dist/environment/custom-types.d.ts +33 -0
  31. package/dist/environment/custom-types.d.ts.map +1 -0
  32. package/dist/environment/custom-types.js +12 -0
  33. package/dist/environment/derived-variables.d.ts +134 -0
  34. package/dist/environment/derived-variables.d.ts.map +1 -0
  35. package/dist/environment/derived-variables.js +169 -0
  36. package/dist/environment/editor-questions.d.ts +4 -0
  37. package/dist/environment/editor-questions.d.ts.map +1 -0
  38. package/dist/environment/editor-questions.js +65 -0
  39. package/dist/environment/git.d.ts +5 -0
  40. package/dist/environment/git.d.ts.map +1 -0
  41. package/dist/environment/git.js +38 -0
  42. package/dist/environment/github.d.ts +26 -0
  43. package/dist/environment/github.d.ts.map +1 -0
  44. package/dist/environment/github.js +244 -0
  45. package/dist/environment/index.d.ts +5 -0
  46. package/dist/environment/index.d.ts.map +1 -0
  47. package/dist/environment/index.js +71 -0
  48. package/dist/environment/logger.d.ts +15 -0
  49. package/dist/environment/logger.d.ts.map +1 -0
  50. package/dist/environment/logger.js +25 -0
  51. package/dist/environment/manage-users.d.ts +11 -0
  52. package/dist/environment/manage-users.d.ts.map +1 -0
  53. package/dist/environment/manage-users.js +494 -0
  54. package/dist/environment/questions-helper.d.ts +15 -0
  55. package/dist/environment/questions-helper.d.ts.map +1 -0
  56. package/dist/environment/questions-helper.js +70 -0
  57. package/dist/environment/questions.d.ts +199 -0
  58. package/dist/environment/questions.d.ts.map +1 -0
  59. package/dist/environment/questions.js +412 -0
  60. package/dist/environment/setup-environment.d.ts +2 -0
  61. package/dist/environment/setup-environment.d.ts.map +1 -0
  62. package/dist/environment/setup-environment.js +773 -0
  63. package/dist/environment/ssh-keygen.d.ts +5 -0
  64. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  65. package/dist/environment/ssh-keygen.js +18 -0
  66. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  67. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  68. package/dist/environment/swarm-to-k8s.js +172 -0
  69. package/dist/environment/templates.d.ts +27 -0
  70. package/dist/environment/templates.d.ts.map +1 -0
  71. package/dist/environment/templates.js +159 -0
  72. package/dist/environment/update-workflows.d.ts +2 -0
  73. package/dist/environment/update-workflows.d.ts.map +1 -0
  74. package/dist/environment/update-workflows.js +168 -0
  75. package/dist/environment/users.d.ts +2 -0
  76. package/dist/environment/users.d.ts.map +1 -0
  77. package/dist/environment/users.js +110 -0
  78. package/dist/environment/utils.d.ts +18 -0
  79. package/dist/environment/utils.d.ts.map +1 -0
  80. package/dist/environment/utils.js +100 -0
  81. package/dist/events/index.js +1049 -233
  82. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  83. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  84. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  85. package/dist/migrations/v2.0/index.js +10 -4
  86. package/dist/notification/index.js +883 -131
  87. package/dist/scopes/index.d.ts +4 -6
  88. package/dist/scopes/index.js +9 -3
  89. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  90. package/dist/templates/charts-values/dependencies/values.yaml +82 -0
  91. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  92. package/dist/templates/charts-values/opencrvs-services/values.yaml +79 -0
  93. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  94. package/dist/templates/charts-values/traefik/values.yaml +116 -0
  95. package/dist/templates/inventory/inventory.template.yml +100 -0
  96. package/dist/templates/inventory/production.example.yml +77 -0
  97. package/dist/templates/inventory/qa.example.yml +48 -0
  98. package/opencrvs-toolkit-2.0.0-rc.d23bb0b.tgz +0 -0
  99. package/package.json +20 -2
  100. package/tsconfig.tsbuildinfo +1 -1
  101. package/opencrvs-toolkit-2.0.0-rc.d1ea58b.tgz +0 -0
@@ -654,7 +654,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
654
654
  ShowConditional,
655
655
  // Action can be shown to the user in the list but as disabled
656
656
  EnableConditional
657
- ]);
657
+ ]).meta({
658
+ id: "ActionConditional",
659
+ 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."
660
+ });
658
661
  var DisplayOnReviewConditional = z7.object({
659
662
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
660
663
  conditional: Conditional
@@ -669,8 +672,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
669
672
  // Field output can be shown / hidden on the review page
670
673
  DisplayOnReviewConditional
671
674
  ]).meta({
672
- description: "Field conditional configuration",
673
- id: "FieldConditional"
675
+ id: "FieldConditional",
676
+ 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."
674
677
  });
675
678
 
676
679
  // ../commons/src/events/FieldType.ts
@@ -767,6 +770,11 @@ var FieldTypesToHideInReview = [
767
770
  FieldType.ALPHA_PRINT_BUTTON,
768
771
  FieldType.ALPHA_HIDDEN
769
772
  ];
773
+ var HiddenFieldTypes = [
774
+ FieldType.HTTP,
775
+ FieldType.QUERY_PARAM_READER,
776
+ FieldType.ALPHA_HIDDEN
777
+ ];
770
778
 
771
779
  // ../commons/src/events/FieldValue.ts
772
780
  var z12 = __toESM(require("zod/v4"));
@@ -885,7 +893,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
885
893
  // ../commons/src/events/FieldValue.ts
886
894
  var TextValue = z12.string();
887
895
  var HiddenFieldValue = z12.string();
888
- var NonEmptyTextValue = TextValue.min(1);
896
+ var NonEmptyTextValue = z12.string().trim().min(1);
889
897
  var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
890
898
  var AgeValue = z12.object({
891
899
  age: z12.number(),
@@ -914,6 +922,7 @@ var DateRangeFieldValue = z12.object({
914
922
  var EmailValue = z12.email();
915
923
  var CheckboxFieldValue = z12.boolean();
916
924
  var NumberFieldValue = z12.number();
925
+ var SignatureFieldValue = FileFieldValue;
917
926
  var ButtonFieldValue = z12.number();
918
927
  var VerificationStatusValue = z12.enum([
919
928
  "verified",
@@ -1212,8 +1221,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1212
1221
  var ApprovedCorrectionAction = ActionBase.extend(
1213
1222
  z14.object({
1214
1223
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1215
- requestId: z14.string()
1224
+ requestId: z14.string(),
1216
1225
  // TODO move into 'content' property
1226
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1217
1227
  }).shape
1218
1228
  );
1219
1229
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1305,6 +1315,9 @@ var FlagConfig = z15.object({
1305
1315
  "Indicates if this flag expects an action to be performed to be cleared."
1306
1316
  ),
1307
1317
  label: TranslationConfig.describe("Human readable label of the flag.")
1318
+ }).meta({
1319
+ id: "FlagConfig",
1320
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1308
1321
  });
1309
1322
  var ActionFlagConfig = z15.object({
1310
1323
  id: Flag,
@@ -1312,6 +1325,9 @@ var ActionFlagConfig = z15.object({
1312
1325
  conditional: Conditional.optional().describe(
1313
1326
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1314
1327
  )
1328
+ }).meta({
1329
+ id: "ActionFlagConfig",
1330
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1315
1331
  });
1316
1332
 
1317
1333
  // ../commons/src/events/EventMetadata.ts
@@ -1467,7 +1483,8 @@ var Range = import_v4.z.object({
1467
1483
  });
1468
1484
  var ContainsFlags = import_v4.z.object({
1469
1485
  anyOf: import_v4.z.array(Flag).optional(),
1470
- noneOf: import_v4.z.array(Flag).optional()
1486
+ noneOf: import_v4.z.array(Flag).optional(),
1487
+ allOf: import_v4.z.array(Flag).optional()
1471
1488
  }).meta({
1472
1489
  id: "ContainsFlags"
1473
1490
  });
@@ -1653,14 +1670,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1653
1670
  }
1654
1671
  }).describe("Unique identifier for the field");
1655
1672
  var FieldReference = import_v43.default.object({
1656
- $$field: FieldId,
1673
+ $$field: FieldId.describe("Id of the field to reference"),
1657
1674
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1658
1675
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1676
+ ),
1677
+ $$code: import_v43.default.string().optional().describe(
1678
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1659
1679
  )
1660
- }).describe("Reference to a field by its ID");
1680
+ }).describe(
1681
+ "Reference to a field value, with an optional client-side computation applied."
1682
+ );
1683
+ var ComputedDefaultValue = import_v43.default.object({
1684
+ $$code: import_v43.default.string().describe(
1685
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1686
+ )
1687
+ }).describe("A context-only computation used as a field default value.");
1661
1688
  var ValidationConfig = import_v43.default.object({
1662
- validator: Conditional,
1663
- message: TranslationConfig
1689
+ validator: Conditional.describe(
1690
+ "Conditional expression that must hold for the field value to be considered valid."
1691
+ ),
1692
+ message: TranslationConfig.describe(
1693
+ "Error message displayed when the validator does not hold."
1694
+ )
1695
+ }).meta({
1696
+ id: "ValidationConfig",
1697
+ 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."
1664
1698
  });
1665
1699
  var requiredSchema = import_v43.default.union([
1666
1700
  import_v43.default.boolean(),
@@ -1691,7 +1725,7 @@ var BaseField = import_v43.default.object({
1691
1725
  "Indicates whether the field can be modified during record correction."
1692
1726
  ),
1693
1727
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1694
- "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."
1728
+ "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."
1695
1729
  ),
1696
1730
  analytics: import_v43.default.boolean().default(false).optional().describe(
1697
1731
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1699,30 +1733,40 @@ var BaseField = import_v43.default.object({
1699
1733
  }).describe("Common properties shared across all field types.");
1700
1734
  var Divider = BaseField.extend({
1701
1735
  type: import_v43.default.literal(FieldType.DIVIDER)
1736
+ }).meta({
1737
+ description: "A horizontal line divider",
1738
+ id: "Divider"
1702
1739
  });
1703
1740
  var TextField = BaseField.extend({
1704
1741
  type: import_v43.default.literal(FieldType.TEXT),
1705
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1742
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1706
1743
  configuration: import_v43.default.object({
1707
1744
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1708
1745
  type: import_v43.default.enum(["text", "password"]).optional(),
1709
1746
  prefix: TranslationConfig.optional(),
1710
1747
  postfix: TranslationConfig.optional()
1711
1748
  }).default({ type: "text" }).optional()
1712
- }).describe("Text input");
1749
+ }).meta({
1750
+ description: "A text input field",
1751
+ id: "TextField"
1752
+ });
1713
1753
  var NumberField = BaseField.extend({
1714
1754
  type: import_v43.default.literal(FieldType.NUMBER),
1715
- defaultValue: NumberFieldValue.optional(),
1755
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1716
1756
  configuration: import_v43.default.object({
1717
1757
  min: import_v43.default.number().optional().describe("Minimum value"),
1718
1758
  max: import_v43.default.number().optional().describe("Maximum value"),
1759
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1719
1760
  prefix: TranslationConfig.optional(),
1720
1761
  postfix: TranslationConfig.optional()
1721
1762
  }).optional()
1722
- }).describe("Number input");
1763
+ }).meta({
1764
+ description: "A number input field",
1765
+ id: "NumberField"
1766
+ });
1723
1767
  var TextAreaField = BaseField.extend({
1724
1768
  type: import_v43.default.literal(FieldType.TEXTAREA),
1725
- defaultValue: NonEmptyTextValue.optional(),
1769
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1726
1770
  configuration: import_v43.default.object({
1727
1771
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1728
1772
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1730,7 +1774,10 @@ var TextAreaField = BaseField.extend({
1730
1774
  prefix: TranslationConfig.optional(),
1731
1775
  postfix: TranslationConfig.optional()
1732
1776
  }).default({ rows: 4 }).optional()
1733
- }).describe("Multiline text input");
1777
+ }).meta({
1778
+ description: "A multiline text input",
1779
+ id: "TextAreaField"
1780
+ });
1734
1781
  var ImageMimeType = import_v43.default.enum([
1735
1782
  "image/png",
1736
1783
  "image/jpg",
@@ -1753,58 +1800,76 @@ var SignatureField = BaseField.extend({
1753
1800
  signaturePromptLabel: TranslationConfig.describe(
1754
1801
  "Title of the signature modal"
1755
1802
  ),
1756
- defaultValue: FieldValue.optional(),
1803
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1757
1804
  configuration: import_v43.default.object({
1758
1805
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1759
1806
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1760
1807
  }).default({
1761
1808
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1762
1809
  })
1763
- }).describe("Signature input field");
1810
+ }).meta({
1811
+ description: "A signature input field",
1812
+ id: "SignatureField"
1813
+ });
1764
1814
  var EmailField = BaseField.extend({
1765
1815
  type: import_v43.default.literal(FieldType.EMAIL),
1766
1816
  configuration: import_v43.default.object({
1767
1817
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1768
1818
  }).default({ maxLength: 255 }).optional(),
1769
- defaultValue: NonEmptyTextValue.optional()
1819
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1820
+ }).meta({
1821
+ description: "An email input field",
1822
+ id: "EmailField"
1770
1823
  });
1771
1824
  var DateField = BaseField.extend({
1772
1825
  type: import_v43.default.literal(FieldType.DATE),
1773
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1826
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1774
1827
  configuration: import_v43.default.object({
1775
1828
  notice: TranslationConfig.describe(
1776
1829
  "Text to display above the date input"
1777
1830
  ).optional()
1778
1831
  }).optional()
1779
- }).describe("A single date input (yyyy-MM-dd)");
1832
+ }).meta({
1833
+ description: "A date input (yyyy-MM-dd)",
1834
+ id: "DateField"
1835
+ });
1780
1836
  var AgeField = BaseField.extend({
1781
1837
  type: import_v43.default.literal(FieldType.AGE),
1782
- defaultValue: NumberFieldValue.optional(),
1838
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1783
1839
  configuration: import_v43.default.object({
1784
1840
  asOfDate: FieldReference,
1785
1841
  prefix: TranslationConfig.optional(),
1786
1842
  postfix: TranslationConfig.optional()
1787
1843
  })
1788
- }).describe("An age input field which uses the current date as the asOfDate");
1844
+ }).meta({
1845
+ description: "An age input field which uses the current date as the asOfDate",
1846
+ id: "AgeField"
1847
+ });
1789
1848
  var TimeField = BaseField.extend({
1790
1849
  type: import_v43.default.literal(FieldType.TIME),
1791
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1850
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1792
1851
  configuration: import_v43.default.object({
1793
1852
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1794
1853
  notice: TranslationConfig.describe(
1795
1854
  "Text to display above the time input"
1796
1855
  ).optional()
1797
1856
  }).optional()
1798
- }).describe("A single date input (HH-mm)");
1857
+ }).meta({
1858
+ description: "A single time input (HH-mm)",
1859
+ id: "TimeField"
1860
+ });
1799
1861
  var DateRangeField = BaseField.extend({
1800
1862
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1801
- defaultValue: DateRangeFieldValue.optional(),
1863
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1802
1864
  configuration: import_v43.default.object({
1803
1865
  notice: TranslationConfig.describe(
1804
1866
  "Text to display above the date input"
1805
1867
  ).optional()
1806
1868
  }).optional()
1807
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1869
+ }).meta({
1870
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1871
+ id: "DateRangeField"
1872
+ });
1808
1873
  var HtmlFontVariant = import_v43.default.enum([
1809
1874
  "reg12",
1810
1875
  "reg14",
@@ -1848,21 +1913,33 @@ var ImageViewField = BaseField.extend({
1848
1913
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1849
1914
  defaultValue: NonEmptyTextValue.optional(),
1850
1915
  configuration: ImageConfiguration
1851
- }).describe("A read-only image component for form pages");
1916
+ }).meta({
1917
+ description: "A read-only image component for form pages",
1918
+ id: "ImageViewField"
1919
+ });
1852
1920
  var Paragraph = BaseField.extend({
1853
1921
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1854
1922
  configuration: ParagraphConfiguration
1855
- }).describe("A read-only HTML <p> paragraph");
1923
+ }).meta({
1924
+ description: "A read-only HTML <p> paragraph",
1925
+ id: "Paragraph"
1926
+ });
1856
1927
  var Heading = BaseField.extend({
1857
1928
  type: import_v43.default.literal(FieldType.HEADING),
1858
1929
  configuration: HeadingConfiguration
1859
- }).describe("A read-only heading component for form pages");
1930
+ }).meta({
1931
+ description: "A read-only heading component for form pages",
1932
+ id: "Heading"
1933
+ });
1860
1934
  var PageHeader = BaseField.extend({
1861
1935
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1862
- }).describe("A read-only header component for form pages");
1936
+ }).meta({
1937
+ description: "A read-only header component for form pages",
1938
+ id: "PageHeader"
1939
+ });
1863
1940
  var File = BaseField.extend({
1864
1941
  type: import_v43.default.literal(FieldType.FILE),
1865
- defaultValue: FileFieldValue.optional(),
1942
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1866
1943
  configuration: import_v43.default.object({
1867
1944
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1868
1945
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1878,7 +1955,10 @@ var File = BaseField.extend({
1878
1955
  }).default({
1879
1956
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1880
1957
  })
1881
- }).describe("File upload");
1958
+ }).meta({
1959
+ description: "A file upload field",
1960
+ id: "File"
1961
+ });
1882
1962
  var SelectOption = import_v43.default.object({
1883
1963
  value: import_v43.default.string().describe("The value of the option"),
1884
1964
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1886,7 +1966,7 @@ var SelectOption = import_v43.default.object({
1886
1966
  });
1887
1967
  var NumberWithUnitField = BaseField.extend({
1888
1968
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1889
- defaultValue: NumberWithUnitFieldValue.optional(),
1969
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1890
1970
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1891
1971
  configuration: import_v43.default.object({
1892
1972
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1895,17 +1975,23 @@ var NumberWithUnitField = BaseField.extend({
1895
1975
  "Placeholder for the number field"
1896
1976
  )
1897
1977
  }).optional()
1898
- }).describe("Number with unit input");
1978
+ }).meta({
1979
+ description: "A number with unit input field",
1980
+ id: "NumberWithUnitField"
1981
+ });
1899
1982
  var RadioGroup = BaseField.extend({
1900
1983
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1901
- defaultValue: TextValue.optional(),
1984
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1902
1985
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1903
1986
  configuration: import_v43.default.object({
1904
1987
  styles: import_v43.default.object({
1905
1988
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1906
1989
  }).optional()
1907
1990
  }).optional()
1908
- }).describe("Grouped radio options");
1991
+ }).meta({
1992
+ description: "A grouped radio button field",
1993
+ id: "RadioGroup"
1994
+ });
1909
1995
  var BulletList = BaseField.extend({
1910
1996
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1911
1997
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1914,10 +2000,13 @@ var BulletList = BaseField.extend({
1914
2000
  fontVariant: HtmlFontVariant.optional()
1915
2001
  }).optional()
1916
2002
  }).default({})
1917
- }).describe("A list of bullet points");
2003
+ }).meta({
2004
+ description: "A list of bullet points",
2005
+ id: "BulletList"
2006
+ });
1918
2007
  var Select = BaseField.extend({
1919
2008
  type: import_v43.default.literal(FieldType.SELECT),
1920
- defaultValue: TextValue.optional(),
2009
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1921
2010
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1922
2011
  noOptionsMessage: TranslationConfig.optional().describe(
1923
2012
  `
@@ -1929,16 +2018,22 @@ var Select = BaseField.extend({
1929
2018
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1930
2019
  `
1931
2020
  )
1932
- }).describe("Select input");
2021
+ }).meta({
2022
+ description: "A select input field",
2023
+ id: "Select"
2024
+ });
1933
2025
  var SelectDateRangeOption = import_v43.default.object({
1934
2026
  value: SelectDateRangeValue.describe("The value of the option"),
1935
2027
  label: TranslationConfig.describe("The label of the option")
1936
2028
  });
1937
2029
  var SelectDateRangeField = BaseField.extend({
1938
2030
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1939
- defaultValue: SelectDateRangeValue.optional(),
2031
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1940
2032
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1941
- }).describe("Select input with date range options");
2033
+ }).meta({
2034
+ description: "A date range selection field",
2035
+ id: "SelectDateRangeField"
2036
+ });
1942
2037
  var NameConfig = import_v43.default.object({
1943
2038
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1944
2039
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1950,7 +2045,7 @@ var NameField = BaseField.extend({
1950
2045
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1951
2046
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1952
2047
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1953
- }).optional(),
2048
+ }).or(ComputedDefaultValue).optional(),
1954
2049
  configuration: import_v43.default.object({
1955
2050
  name: NameConfig.default({
1956
2051
  firstname: { required: true },
@@ -1969,26 +2064,41 @@ var NameField = BaseField.extend({
1969
2064
  surname: { required: true }
1970
2065
  }
1971
2066
  }).optional()
1972
- }).describe("Name input field");
2067
+ }).meta({
2068
+ description: "A field for entering a persons name",
2069
+ id: "NameField"
2070
+ });
1973
2071
  var PhoneField = BaseField.extend({
1974
- defaultValue: NonEmptyTextValue.optional(),
2072
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1975
2073
  type: import_v43.default.literal(FieldType.PHONE)
1976
- }).describe("Phone input field");
2074
+ }).meta({
2075
+ description: "A field for entering a phone number",
2076
+ id: "PhoneField"
2077
+ });
1977
2078
  var IdField = BaseField.extend({
1978
- defaultValue: NonEmptyTextValue.optional(),
2079
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1979
2080
  type: import_v43.default.literal(FieldType.ID)
1980
- }).describe("ID input field");
2081
+ }).meta({
2082
+ description: "A field for entering an ID",
2083
+ id: "IdField"
2084
+ });
1981
2085
  var Checkbox = BaseField.extend({
1982
2086
  type: import_v43.default.literal(FieldType.CHECKBOX),
1983
- defaultValue: CheckboxFieldValue.default(false)
1984
- }).describe("Boolean checkbox field");
2087
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
2088
+ }).meta({
2089
+ description: "A boolean checkbox field",
2090
+ id: "Checkbox"
2091
+ });
1985
2092
  var Country = BaseField.extend({
1986
2093
  type: import_v43.default.literal(FieldType.COUNTRY),
1987
- defaultValue: NonEmptyTextValue.optional(),
2094
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1988
2095
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1989
2096
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1990
2097
  )
1991
- }).describe("Country select field");
2098
+ }).meta({
2099
+ description: "A field for selecting a country",
2100
+ id: "Country"
2101
+ });
1992
2102
  var AllowedLocations = JurisdictionReference.optional().describe(
1993
2103
  "Limits which location options are selectable depending on user jurisdiction and location."
1994
2104
  );
@@ -1997,28 +2107,33 @@ var AdministrativeAreas = import_v43.default.enum([
1997
2107
  "HEALTH_FACILITY",
1998
2108
  "CRVS_OFFICE"
1999
2109
  ]);
2000
- var AdministrativeAreaConfiguration = import_v43.default.object({
2001
- partOf: FieldReference.optional().describe("Parent location"),
2002
- type: AdministrativeAreas,
2003
- allowedLocations: AllowedLocations
2004
- }).describe("Administrative area options");
2005
2110
  var AdministrativeAreaField = BaseField.extend({
2006
2111
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
2007
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2008
- configuration: AdministrativeAreaConfiguration
2009
- }).describe("Administrative area input field e.g. facility, office");
2112
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2113
+ configuration: import_v43.default.object({
2114
+ partOf: FieldReference.optional().describe("Parent location"),
2115
+ type: AdministrativeAreas,
2116
+ allowedLocations: AllowedLocations
2117
+ }).describe("Administrative area options")
2118
+ }).meta({
2119
+ description: "Administrative area input field",
2120
+ id: "AdministrativeAreaField"
2121
+ });
2010
2122
  var LocationInput = BaseField.extend({
2011
2123
  type: import_v43.default.literal(FieldType.LOCATION),
2012
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2124
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2013
2125
  configuration: import_v43.default.object({
2014
2126
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2015
2127
  allowedLocations: AllowedLocations
2016
2128
  }).optional()
2017
- }).describe("Input field for a location");
2129
+ }).meta({
2130
+ description: "A field for selecting a location",
2131
+ id: "LocationInput"
2132
+ });
2018
2133
  var FileUploadWithOptions = BaseField.extend({
2019
2134
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2020
2135
  options: import_v43.default.array(SelectOption).describe("A list of options"),
2021
- defaultValue: FileFieldWithOptionValue.optional(),
2136
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
2022
2137
  configuration: import_v43.default.object({
2023
2138
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2024
2139
  maxImageSize: import_v43.default.object({
@@ -2028,15 +2143,18 @@ var FileUploadWithOptions = BaseField.extend({
2028
2143
  }).default({
2029
2144
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2030
2145
  })
2146
+ }).meta({
2147
+ description: "A field for uploading files with file type options",
2148
+ id: "FileUploadWithOptions"
2031
2149
  });
2032
2150
  var Facility = BaseField.extend({
2033
2151
  type: import_v43.default.literal(FieldType.FACILITY),
2034
- defaultValue: NonEmptyTextValue.optional(),
2152
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2035
2153
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2036
2154
  }).describe("Input field for a facility");
2037
2155
  var Office = BaseField.extend({
2038
2156
  type: import_v43.default.literal(FieldType.OFFICE),
2039
- defaultValue: NonEmptyTextValue.optional(),
2157
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2040
2158
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2041
2159
  }).describe("Input field for an office");
2042
2160
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2072,8 +2190,11 @@ var Address = BaseField.extend({
2072
2190
  ).optional(),
2073
2191
  allowedLocations: AllowedLocations
2074
2192
  }).optional(),
2075
- defaultValue: DefaultAddressFieldValue.optional()
2076
- }).describe("Address input field \u2013 a combination of location and text fields");
2193
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2194
+ }).meta({
2195
+ description: "Address input field \u2013 a combination of location and text fields",
2196
+ id: "Address"
2197
+ });
2077
2198
  var StaticDataEntry = import_v43.default.object({
2078
2199
  id: import_v43.default.string().describe("ID for the data entry."),
2079
2200
  label: TranslationConfig,
@@ -2088,7 +2209,10 @@ var DataField = BaseField.extend({
2088
2209
  subtitle: TranslationConfig.optional(),
2089
2210
  data: import_v43.default.array(DataEntry)
2090
2211
  })
2091
- }).describe("Data field for displaying read-only data");
2212
+ }).meta({
2213
+ description: "A field for displaying a table of read-only data",
2214
+ id: "DataField"
2215
+ });
2092
2216
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2093
2217
  var ButtonType = import_v43.default.enum([
2094
2218
  "primary",
@@ -2113,13 +2237,19 @@ var ButtonConfiguration = import_v43.default.object({
2113
2237
  });
2114
2238
  var ButtonField = BaseField.extend({
2115
2239
  type: import_v43.default.literal(FieldType.BUTTON),
2116
- defaultValue: ButtonFieldValue.optional(),
2240
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
2117
2241
  configuration: ButtonConfiguration
2118
- }).describe("Generic button without any built-in functionality");
2242
+ }).meta({
2243
+ description: "A generic button that can be used to trigger an action",
2244
+ id: "ButtonField"
2245
+ });
2119
2246
  var FieldGroup = BaseField.extend({
2120
2247
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2121
2248
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2122
2249
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2250
+ }).meta({
2251
+ description: "A group of fields that are displayed together",
2252
+ id: "FieldGroup"
2123
2253
  });
2124
2254
  var AlphaPrintButton = BaseField.extend({
2125
2255
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2129,10 +2259,13 @@ var AlphaPrintButton = BaseField.extend({
2129
2259
  "Label for the print button"
2130
2260
  )
2131
2261
  })
2132
- }).describe("Print button field for printing certificates");
2262
+ }).meta({
2263
+ description: "An experimental print button field for printing certificates during the declaration process",
2264
+ id: "AlphaPrintButton"
2265
+ });
2133
2266
  var HttpField = BaseField.extend({
2134
2267
  type: import_v43.default.literal(FieldType.HTTP),
2135
- defaultValue: HttpFieldValue.optional(),
2268
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
2136
2269
  configuration: import_v43.default.object({
2137
2270
  trigger: FieldReference.optional().describe(
2138
2271
  "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."
@@ -2145,20 +2278,30 @@ var HttpField = BaseField.extend({
2145
2278
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2146
2279
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2147
2280
  })
2148
- }).describe("HTTP request function triggered by a button click or other event");
2281
+ }).meta({
2282
+ 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.",
2283
+ id: "HttpField"
2284
+ });
2149
2285
  var AutocompleteField = BaseField.extend({
2150
2286
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2151
2287
  configuration: import_v43.default.object({
2152
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2288
+ url: import_v43.default.string().describe(
2289
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2290
+ ).optional(),
2153
2291
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2154
2292
  defaultOptions: import_v43.default.array(
2155
2293
  import_v43.default.object({
2156
2294
  label: import_v43.default.string(),
2157
2295
  value: import_v43.default.string()
2158
2296
  })
2159
- ).optional()
2297
+ ).optional().describe(
2298
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2299
+ )
2160
2300
  })
2161
- }).describe("Autocomplete input field");
2301
+ }).meta({
2302
+ 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.",
2303
+ id: "AutocompleteField"
2304
+ });
2162
2305
  var SearchField = HttpField.extend({
2163
2306
  type: import_v43.default.literal(FieldType.SEARCH),
2164
2307
  configuration: SearchQuery.pick({
@@ -2191,6 +2334,9 @@ var SearchField = HttpField.extend({
2191
2334
  ok: TranslationConfig.optional()
2192
2335
  }).optional()
2193
2336
  })
2337
+ }).meta({
2338
+ description: "A search input field",
2339
+ id: "SearchField"
2194
2340
  });
2195
2341
  var LinkButtonField = BaseField.extend({
2196
2342
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2199,28 +2345,35 @@ var LinkButtonField = BaseField.extend({
2199
2345
  text: TranslationConfig.describe("Text to display on the button"),
2200
2346
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2201
2347
  })
2202
- }).describe("Button that opens a link");
2348
+ }).meta({
2349
+ description: "A button that opens a URL link",
2350
+ id: "LinkButtonField"
2351
+ });
2203
2352
  var VerificationStatus = BaseField.extend({
2204
2353
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2205
- defaultValue: VerificationStatusValue.optional(),
2354
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
2206
2355
  configuration: import_v43.default.object({
2207
2356
  status: TranslationConfig.describe("Text to display on the status pill."),
2208
2357
  description: TranslationConfig.describe(
2209
2358
  "Explaining text on the banner in form."
2210
2359
  )
2211
2360
  })
2361
+ }).meta({
2362
+ 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.",
2363
+ id: "VerificationStatus"
2212
2364
  });
2213
2365
  var QueryParamReaderField = BaseField.extend({
2214
2366
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2215
2367
  configuration: import_v43.default.object({
2216
2368
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2217
2369
  })
2218
- }).describe(
2219
- "A field that maps URL query params into form values and clears them afterward"
2220
- );
2370
+ }).meta({
2371
+ description: "A field that maps URL query params into form values and clears them afterward",
2372
+ id: "QueryParamReaderField"
2373
+ });
2221
2374
  var QrReaderField = BaseField.extend({
2222
2375
  type: import_v43.default.literal(FieldType.QR_READER),
2223
- defaultValue: QrReaderFieldValue.optional(),
2376
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
2224
2377
  configuration: import_v43.default.object({
2225
2378
  validator: import_v43.default.any().meta({
2226
2379
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -2228,21 +2381,27 @@ var QrReaderField = BaseField.extend({
2228
2381
  })
2229
2382
  }).optional()
2230
2383
  }).meta({
2231
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2384
+ description: "QR code reader field, including optional JSON Schema validator.",
2232
2385
  id: "QrReaderField"
2233
2386
  });
2234
2387
  var IdReaderField = BaseField.extend({
2235
2388
  type: import_v43.default.literal(FieldType.ID_READER),
2236
- defaultValue: IdReaderFieldValue.optional(),
2389
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
2237
2390
  methods: import_v43.default.array(
2238
2391
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2239
2392
  )
2393
+ }).meta({
2394
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2395
+ id: "IdReaderField"
2240
2396
  });
2241
2397
  var CustomField = BaseField.extend({
2242
2398
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2243
2399
  defaultValue: CustomFieldValue.optional(),
2244
2400
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2245
2401
  configuration: import_v43.default.unknown().optional()
2402
+ }).meta({
2403
+ description: "An expiremental custom field that is defined by a module source path",
2404
+ id: "CustomField"
2246
2405
  });
2247
2406
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2248
2407
  var LoaderField = BaseField.extend({
@@ -2252,22 +2411,25 @@ var LoaderField = BaseField.extend({
2252
2411
  configuration: import_v43.default.object({
2253
2412
  text: TranslationConfig.describe("Display text above the loading spinner")
2254
2413
  })
2255
- }).describe(
2256
- "A non-interactive field that indicates an in progress operation in form"
2257
- );
2414
+ }).meta({
2415
+ description: "A non-interactive field that indicates an in progress operation in form",
2416
+ id: "LoaderField"
2417
+ });
2258
2418
  var HiddenField = BaseField.extend({
2259
2419
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2260
2420
  required: import_v43.default.boolean().default(false).optional(),
2261
2421
  defaultValue: TextValue.optional()
2262
- }).describe(
2263
- "A non-interactive, hidden field that only hold a value in the form"
2264
- );
2422
+ }).meta({
2423
+ description: "A non-interactive, hidden field that only hold a value in the form",
2424
+ id: "HiddenField"
2425
+ });
2265
2426
  var UserRoleField = BaseField.extend({
2266
2427
  type: import_v43.default.literal(FieldType.USER_ROLE),
2267
2428
  defaultValue: TextValue.optional()
2268
- }).describe(
2269
- "A select dropdown that is automatically populated with available user roles"
2270
- );
2429
+ }).meta({
2430
+ description: "A select dropdown that is automatically populated with available user roles",
2431
+ id: "UserRoleField"
2432
+ });
2271
2433
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2272
2434
  FieldGroup,
2273
2435
  Address,
@@ -2366,16 +2528,19 @@ var VerificationPageConfig = FormPageConfig.extend({
2366
2528
  type: z21.literal(PageTypes.enum.VERIFICATION),
2367
2529
  actions: VerificationActionConfig
2368
2530
  });
2369
- var PageConfig = z21.discriminatedUnion("type", [
2370
- FormPageConfig,
2371
- VerificationPageConfig
2372
- ]);
2531
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2532
+ id: "PageConfig",
2533
+ description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
2534
+ });
2373
2535
 
2374
2536
  // ../commons/src/events/FormConfig.ts
2375
2537
  var DeclarationFormConfig = z22.object({
2376
2538
  label: TranslationConfig.describe("Human readable description of the form"),
2377
2539
  pages: z22.array(FormPageConfig)
2378
- }).describe("Configuration of the declaration form.");
2540
+ }).meta({
2541
+ id: "DeclarationFormConfig",
2542
+ description: "Configuration of the declaration form."
2543
+ });
2379
2544
  var ActionFormConfig = z22.object({
2380
2545
  label: TranslationConfig.describe("Human readable description of the form"),
2381
2546
  pages: z22.array(PageConfig)
@@ -2475,6 +2640,9 @@ var DeduplicationConfig = z23.object({
2475
2640
  id: z23.string(),
2476
2641
  label: TranslationConfig,
2477
2642
  query: Clause
2643
+ }).meta({
2644
+ id: "DeduplicationConfig",
2645
+ description: "Configuration for duplicate detection on a declare or register action. The query is built from fuzzy / strict / date-range matchers combined with and/or/not."
2478
2646
  });
2479
2647
 
2480
2648
  // ../commons/src/events/ActionConfig.ts
@@ -2512,6 +2680,11 @@ var ReadActionConfig = ActionConfigBase.extend(
2512
2680
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2513
2681
  }).shape
2514
2682
  );
2683
+ var NotifyConfig = ActionConfigBase.extend(
2684
+ z24.object({
2685
+ type: z24.literal(ActionType.NOTIFY)
2686
+ }).shape
2687
+ );
2515
2688
  var DeclareConfig = DeclarationActionBase.extend(
2516
2689
  z24.object({
2517
2690
  type: z24.literal(ActionType.DECLARE),
@@ -2592,17 +2765,46 @@ var ActionConfig = z24.discriminatedUnion("type", [
2592
2765
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2593
2766
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2594
2767
  */
2595
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2596
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2597
- RejectConfig.meta({ id: "RejectActionConfig" }),
2598
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2768
+ ReadActionConfig.meta({
2769
+ id: "ReadActionConfig",
2770
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2771
+ }),
2772
+ NotifyConfig.meta({
2773
+ id: "NotifyActionConfig",
2774
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2775
+ }),
2776
+ DeclareConfig.meta({
2777
+ id: "DeclareActionConfig",
2778
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2779
+ }),
2780
+ RejectConfig.meta({
2781
+ id: "RejectActionConfig",
2782
+ description: "Configuration for rejecting a record before registration."
2783
+ }),
2784
+ RegisterConfig.meta({
2785
+ id: "RegisterActionConfig",
2786
+ description: "Configuration for registering a record."
2787
+ }),
2599
2788
  PrintCertificateActionConfig.meta({
2600
- id: "PrintCertificateActionConfig"
2789
+ id: "PrintCertificateActionConfig",
2790
+ description: "Configuration for printing a certificate of a registered record."
2791
+ }),
2792
+ RequestCorrectionConfig.meta({
2793
+ id: "RequestCorrectionActionConfig",
2794
+ description: "Configuration for requesting a correction on a registered record."
2795
+ }),
2796
+ EditActionConfig.meta({
2797
+ id: "EditActionConfig",
2798
+ description: "Configuration for editing a record before registration."
2601
2799
  }),
2602
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2603
- EditActionConfig.meta({ id: "EditActionConfig" }),
2604
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2605
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2800
+ ArchiveConfig.meta({
2801
+ id: "ArchiveActionConfig",
2802
+ description: "Configuration for archiving a record."
2803
+ }),
2804
+ CustomActionConfig.meta({
2805
+ id: "CustomActionConfig",
2806
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
2807
+ })
2606
2808
  ]).describe(
2607
2809
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2608
2810
  ).meta({ id: "ActionConfig" });
@@ -2678,7 +2880,10 @@ var Field = BaseField2.extend({
2678
2880
  }).describe("Custom field defined for the summary view.");
2679
2881
  var SummaryConfig = z27.object({
2680
2882
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2681
- }).describe("Configuration of the event summary section.");
2883
+ }).meta({
2884
+ id: "SummaryConfig",
2885
+ description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
2886
+ });
2682
2887
 
2683
2888
  // ../commons/src/events/AdvancedSearchConfig.ts
2684
2889
  var z28 = __toESM(require("zod/v4"));
@@ -2749,6 +2954,9 @@ var BaseField3 = z28.object({
2749
2954
  ),
2750
2955
  validations: z28.array(ValidationConfig).optional().describe(
2751
2956
  `Option for overriding the field validations specifically for advanced search form.`
2957
+ ),
2958
+ allowedLocations: JurisdictionReference.optional().describe(
2959
+ `Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
2752
2960
  )
2753
2961
  });
2754
2962
  var SearchQueryParams = z28.object({
@@ -2802,6 +3010,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
2802
3010
  var AdvancedSearchConfig = z28.object({
2803
3011
  title: TranslationConfig.describe("Advanced search tab title"),
2804
3012
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3013
+ }).meta({
3014
+ id: "AdvancedSearchConfig",
3015
+ description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
2805
3016
  });
2806
3017
 
2807
3018
  // ../commons/src/events/utils.ts
@@ -2852,7 +3063,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
2852
3063
  }
2853
3064
  return current;
2854
3065
  }
3066
+ function todayISO() {
3067
+ return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3068
+ }
3069
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
3070
+ function compileClientFunction(code) {
3071
+ let fn = compiledFunctionCache.get(code);
3072
+ if (!fn) {
3073
+ fn = new Function(`return (${code})`)();
3074
+ compiledFunctionCache.set(code, fn);
3075
+ }
3076
+ return fn;
3077
+ }
2855
3078
  (0, import_ajv_formats.default)(ajv);
3079
+ function buildClientFunctionContext(input) {
3080
+ return {
3081
+ $form: input.form,
3082
+ $now: todayISO(),
3083
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3084
+ $online: isOnline(),
3085
+ $user: input.validatorContext?.user,
3086
+ $event: input.validatorContext?.event,
3087
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3088
+ user: input.systemVariables?.user,
3089
+ $window: input.systemVariables?.$window,
3090
+ locations: input.locations,
3091
+ adminLevelIds: input.adminLevelIds
3092
+ };
3093
+ }
3094
+ function runClientFunction(code, data, context) {
3095
+ return compileClientFunction(code)(data, context);
3096
+ }
2856
3097
  ajv.addKeyword({
2857
3098
  keyword: "daysFromDate",
2858
3099
  type: "string",
@@ -2897,12 +3138,35 @@ ajv.addKeyword({
2897
3138
  $data: true,
2898
3139
  errors: true,
2899
3140
  // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
2900
- validate(schema, data, _2, dataContext) {
3141
+ validate(_schema, data, _2, dataContext) {
2901
3142
  const locationIdInput = data;
2902
3143
  const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
2903
3144
  return locations.some((location) => location.id === locationIdInput);
2904
3145
  }
2905
3146
  });
3147
+ ajv.addKeyword({
3148
+ keyword: "customClientValidator",
3149
+ schemaType: "object",
3150
+ errors: true,
3151
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3152
+ // `validate()` callers build root data via `buildClientFunctionContext`,
3153
+ // so the cast holds.
3154
+ validate(schema, data, _2, dataContext) {
3155
+ return Boolean(
3156
+ runClientFunction(
3157
+ schema.code,
3158
+ data,
3159
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3160
+ )
3161
+ );
3162
+ }
3163
+ });
3164
+ function isOnline() {
3165
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3166
+ return navigator.onLine;
3167
+ }
3168
+ return true;
3169
+ }
2906
3170
 
2907
3171
  // ../commons/src/utils.ts
2908
3172
  var z32 = __toESM(require("zod/v4"));
@@ -2945,7 +3209,7 @@ var getActionAnnotationFields = (actionConfig) => {
2945
3209
  if (actionConfig.type === ActionType.CUSTOM) {
2946
3210
  return actionConfig.form;
2947
3211
  }
2948
- if ("review" in actionConfig) {
3212
+ if ("review" in actionConfig && actionConfig.review != null) {
2949
3213
  return actionConfig.review.fields;
2950
3214
  }
2951
3215
  return [];
@@ -3521,7 +3785,54 @@ function createFieldConditionals(fieldId) {
3521
3785
  }
3522
3786
  },
3523
3787
  required: [fieldId]
3524
- })
3788
+ }),
3789
+ /**
3790
+ * Custom client-side validator. The provided function is serialised and executed
3791
+ * just-in-time on the client only. External references (e.g. lodash) are not
3792
+ * available inside the function body — all logic must be self-contained.
3793
+ *
3794
+ * @example
3795
+ * field('nid').customClientValidator((value) => {
3796
+ * // LUHN check — all logic must be inline
3797
+ * const digits = String(value).split('').map(Number)
3798
+ * // ...
3799
+ * return isValid
3800
+ * })
3801
+ */
3802
+ customClientValidator(validationFn) {
3803
+ const code = validationFn.toString();
3804
+ return defineFormConditional({
3805
+ type: "object",
3806
+ properties: wrapToPath(
3807
+ { [fieldId]: { customClientValidator: { code } } },
3808
+ this.$$subfield
3809
+ ),
3810
+ required: [fieldId]
3811
+ });
3812
+ },
3813
+ /**
3814
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
3815
+ * that can be used as the `value` property or a DATA component entry.
3816
+ * The function receives the referenced field's value as the first argument and
3817
+ * the full form context as the second; its return value replaces the field reference.
3818
+ * The function is serialised and executed just-in-time on the client only.
3819
+ * External references (e.g. lodash) are not available inside the function body.
3820
+ *
3821
+ * For computing a default value without referencing a specific field, use
3822
+ * `evaluate(fn)` in the `defaultValue` property instead.
3823
+ *
3824
+ * @example
3825
+ * field('a').customClientEvaluation((aValue, ctx) =>
3826
+ * Number(aValue) + Number(ctx.$form.b)
3827
+ * )
3828
+ */
3829
+ customClientEvaluation(computationFn) {
3830
+ return {
3831
+ $$code: computationFn.toString(),
3832
+ $$field: fieldId,
3833
+ $$subfield: this.$$subfield
3834
+ };
3835
+ }
3525
3836
  };
3526
3837
  }
3527
3838
 
@@ -3669,7 +3980,7 @@ var _EventConfigBase = z33.object({
3669
3980
  ),
3670
3981
  label: TranslationConfig.describe("Human-readable label for the event type."),
3671
3982
  actions: z33.array(ActionConfig).describe(
3672
- "Configuration of system-defined actions associated with the event."
3983
+ "Configuration of core and custom actions associated with the event."
3673
3984
  ),
3674
3985
  actionOrder: z33.array(z33.string()).optional().describe(
3675
3986
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3681,7 +3992,7 @@ var _EventConfigBase = z33.object({
3681
3992
  "Configuration of fields available in the advanced search feature."
3682
3993
  ),
3683
3994
  flags: z33.array(FlagConfig).optional().default([]).describe(
3684
- "Configuration of flags associated with the actions of this event type."
3995
+ "Configuration of custom flags associated with the actions of this event type."
3685
3996
  ),
3686
3997
  analytics: z33.boolean().optional().default(true).describe(
3687
3998
  "Indicates whether the records of this event type are included in analytics"
@@ -3694,8 +4005,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
3694
4005
  validateActionFlags(event2, ctx);
3695
4006
  validateActionOrder(event2, ctx);
3696
4007
  }).meta({
3697
- id: "EventConfig"
3698
- }).describe("Configuration defining an event type.");
4008
+ id: "EventConfig",
4009
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
4010
+ });
3699
4011
 
3700
4012
  // ../commons/src/events/EventConfigInput.ts
3701
4013
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -3917,6 +4229,9 @@ var WorkqueueColumnValue = z34.object({
3917
4229
  var WorkqueueColumn = z34.object({
3918
4230
  label: TranslationConfig,
3919
4231
  value: WorkqueueColumnValue
4232
+ }).meta({
4233
+ id: "WorkqueueColumn",
4234
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
3920
4235
  });
3921
4236
  function defineWorkqueuesColumns(workqueueColumns) {
3922
4237
  return workqueueColumns.map(
@@ -4119,18 +4434,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4119
4434
  query: true,
4120
4435
  columns: true
4121
4436
  });
4122
- var WorkqueueConfigInput = z37.object({
4123
- slug: z37.string().describe("Determines the url of the workqueue."),
4124
- name: TranslationConfig.describe(
4125
- "Title of the workflow (both in navigation and on the page)"
4126
- ),
4127
- query: CountryConfigQueryInputType,
4128
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4129
- "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
4130
- ),
4131
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4132
- icon: AvailableIcons,
4133
- emptyMessage: TranslationConfig.optional()
4437
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4438
+ query: CountryConfigQueryInputType
4439
+ }).meta({
4440
+ id: "WorkqueueConfig",
4441
+ description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
4134
4442
  });
4135
4443
  var WorkqueueCountInput = z37.array(
4136
4444
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4172,7 +4480,9 @@ var BaseActionInput = z38.object({
4172
4480
  keepAssignment: z38.boolean().optional(),
4173
4481
  keepAssignmentIfAccepted: z38.boolean().optional(),
4174
4482
  keepAssignmentIfRejected: z38.boolean().optional(),
4175
- waitFor: z38.boolean().optional(),
4483
+ waitFor: z38.boolean().default(true).describe(
4484
+ "Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
4485
+ ),
4176
4486
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4177
4487
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4178
4488
  createdAtLocation: UUID.nullish().describe(
@@ -4290,7 +4600,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4290
4600
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4291
4601
  z38.object({
4292
4602
  requestId: z38.string(),
4293
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4603
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4604
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4294
4605
  }).shape
4295
4606
  );
4296
4607
  var ReadActionInput = BaseActionInput.extend(
@@ -4352,7 +4663,7 @@ var Draft = z39.object({
4352
4663
  }).describe(
4353
4664
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4354
4665
  );
4355
- var DraftInput = BaseActionInput.extend({
4666
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4356
4667
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4357
4668
  status: z39.enum([
4358
4669
  ActionStatus.Requested,
@@ -4402,12 +4713,53 @@ var updateActions = ActionTypes.extract([
4402
4713
  ActionType.ARCHIVE,
4403
4714
  ActionType.PRINT_CERTIFICATE,
4404
4715
  ActionType.REQUEST_CORRECTION,
4716
+ ActionType.APPROVE_CORRECTION,
4717
+ ActionType.REJECT_CORRECTION,
4405
4718
  ActionType.CUSTOM
4406
4719
  ]);
4407
4720
 
4408
4721
  // ../commons/src/events/state/flags.ts
4409
4722
  var import_lodash3 = require("lodash");
4410
4723
  var import_date_fns3 = require("date-fns");
4724
+ var INHERENT_FLAG_RULES = [
4725
+ {
4726
+ flag: InherentFlags.CORRECTION_REQUESTED,
4727
+ setOn: [ActionType.REQUEST_CORRECTION],
4728
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4729
+ },
4730
+ {
4731
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4732
+ // other status-changing action (see getStatusFromActions).
4733
+ flag: InherentFlags.INCOMPLETE,
4734
+ setOn: [ActionType.NOTIFY],
4735
+ resetOn: [
4736
+ ActionType.CREATE,
4737
+ ActionType.DECLARE,
4738
+ ActionType.REGISTER,
4739
+ ActionType.ARCHIVE
4740
+ ]
4741
+ },
4742
+ {
4743
+ flag: InherentFlags.REJECTED,
4744
+ setOn: [ActionType.REJECT],
4745
+ resetOn: [
4746
+ ActionType.NOTIFY,
4747
+ ActionType.DECLARE,
4748
+ ActionType.EDIT,
4749
+ ActionType.REGISTER
4750
+ ]
4751
+ },
4752
+ {
4753
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
4754
+ setOn: [ActionType.DUPLICATE_DETECTED],
4755
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4756
+ },
4757
+ {
4758
+ flag: InherentFlags.EDIT_IN_PROGRESS,
4759
+ setOn: [ActionType.EDIT],
4760
+ resetOnAnyOtherAction: true
4761
+ }
4762
+ ];
4411
4763
 
4412
4764
  // ../commons/src/events/defineConfig.ts
4413
4765
  var IGNORED_EVENT_TYPES = [
@@ -5153,6 +5505,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5153
5505
  id: "signature.upload.modal.title",
5154
5506
  defaultMessage: "Draw signature",
5155
5507
  description: "Title for the modal to draw signature"
5508
+ },
5509
+ // Zod applies the schema default at parse time, but this fixture bypasses
5510
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
5511
+ configuration: {
5512
+ maxFileSize: 5 * 1024 * 1024
5156
5513
  }
5157
5514
  }
5158
5515
  ]
@@ -5709,6 +6066,20 @@ var tennisClubMembershipEvent = defineConfig({
5709
6066
  },
5710
6067
  review: TENNIS_CLUB_DECLARATION_REVIEW
5711
6068
  },
6069
+ {
6070
+ type: ActionType.NOTIFY,
6071
+ label: {
6072
+ defaultMessage: "Notify health worker",
6073
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6074
+ id: "event.tennis-club-membership.action.notify.label"
6075
+ },
6076
+ flags: [
6077
+ {
6078
+ id: "health-worker-notified",
6079
+ operation: "add"
6080
+ }
6081
+ ]
6082
+ },
5712
6083
  {
5713
6084
  type: ActionType.REJECT,
5714
6085
  label: {
@@ -5951,6 +6322,17 @@ var tennisClubMembershipEvent = defineConfig({
5951
6322
  }
5952
6323
  }
5953
6324
  ],
6325
+ flags: [
6326
+ {
6327
+ id: "health-worker-notified",
6328
+ requiresAction: false,
6329
+ label: {
6330
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6331
+ defaultMessage: "Health worker notified",
6332
+ description: "Label for the health-worker-notified flag"
6333
+ }
6334
+ }
6335
+ ],
5954
6336
  advancedSearch: [
5955
6337
  {
5956
6338
  title: {
@@ -6946,10 +7328,380 @@ var ACTION_FILTERS = {
6946
7328
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
6947
7329
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
6948
7330
  };
7331
+ var REJECTED_ACTIONS = [
7332
+ ActionType.READ,
7333
+ ActionType.NOTIFY,
7334
+ ActionType.CUSTOM,
7335
+ ActionType.EDIT,
7336
+ ActionType.ARCHIVE
7337
+ ];
6949
7338
 
6950
7339
  // ../commons/src/events/FileUtils.ts
6951
7340
  var import_lodash7 = require("lodash");
6952
7341
 
7342
+ // ../commons/src/events/mocks.test.utils.ts
7343
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7344
+ {
7345
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7346
+ name: "Central",
7347
+ parentId: null,
7348
+ validUntil: null,
7349
+ externalId: "ydyJb1RAy4U1"
7350
+ },
7351
+ {
7352
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7353
+ name: "Sulaka",
7354
+ parentId: null,
7355
+ validUntil: null,
7356
+ externalId: "pQ8nGxWmZ2Q3"
7357
+ },
7358
+ {
7359
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7360
+ name: "Pualula",
7361
+ parentId: null,
7362
+ validUntil: null,
7363
+ externalId: "Aq91DweLmT8k"
7364
+ },
7365
+ {
7366
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7367
+ name: "Chuminga",
7368
+ parentId: null,
7369
+ validUntil: null,
7370
+ externalId: "Rw0fYNh2Xk9a"
7371
+ },
7372
+ {
7373
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7374
+ name: "Ibombo",
7375
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7376
+ validUntil: null,
7377
+ externalId: "k7DsP4vbN1Qe"
7378
+ },
7379
+ {
7380
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
7381
+ name: "Isango",
7382
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7383
+ validUntil: null,
7384
+ externalId: "Gm3Z9eQpHw4L"
7385
+ },
7386
+ {
7387
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7388
+ name: "Isamba",
7389
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7390
+ validUntil: null,
7391
+ externalId: "sT0xVu1KqJ7r"
7392
+ },
7393
+ {
7394
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7395
+ name: "Itambo",
7396
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7397
+ validUntil: null,
7398
+ externalId: "Nq6Bv2HpL9Te"
7399
+ },
7400
+ {
7401
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7402
+ name: "Ezhi",
7403
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7404
+ validUntil: null,
7405
+ externalId: "xK8cQ0ZRy5Wd"
7406
+ },
7407
+ {
7408
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7409
+ name: "Ilanga",
7410
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7411
+ validUntil: null,
7412
+ externalId: "Cq4Jm1XvN8Ls"
7413
+ },
7414
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
7415
+ {
7416
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7417
+ name: "Klow",
7418
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7419
+ validUntil: null,
7420
+ externalId: "IkYcYBUcyY2"
7421
+ },
7422
+ {
7423
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7424
+ name: "Mbondo",
7425
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7426
+ validUntil: null,
7427
+ externalId: "Qhvv5hvo3mY"
7428
+ },
7429
+ {
7430
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7431
+ name: "Ndara",
7432
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7433
+ validUntil: null,
7434
+ externalId: "crXh068O9TR"
7435
+ },
7436
+ {
7437
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7438
+ name: "Olani",
7439
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7440
+ validUntil: null,
7441
+ externalId: "r00It8Tvvp7"
7442
+ },
7443
+ {
7444
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7445
+ name: "Pemba",
7446
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7447
+ validUntil: null,
7448
+ externalId: "ZnUWsbONIaH"
7449
+ },
7450
+ {
7451
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7452
+ name: "Quanza",
7453
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7454
+ validUntil: null,
7455
+ externalId: "fDZycvQTa7l"
7456
+ },
7457
+ {
7458
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7459
+ name: "Rivka",
7460
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7461
+ validUntil: null,
7462
+ externalId: "KqswxCGTELa"
7463
+ },
7464
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
7465
+ {
7466
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7467
+ name: "Mbula",
7468
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7469
+ validUntil: null,
7470
+ externalId: "osEbKjRc9Kg"
7471
+ },
7472
+ {
7473
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7474
+ name: "Ndoki",
7475
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7476
+ validUntil: null,
7477
+ externalId: "aq4daBUAGr3"
7478
+ },
7479
+ {
7480
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7481
+ name: "Tsanga",
7482
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7483
+ validUntil: null,
7484
+ externalId: "cqis6Y8trbJ"
7485
+ },
7486
+ {
7487
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7488
+ name: "Waziri",
7489
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7490
+ validUntil: null,
7491
+ externalId: "LMijHPyyx6d"
7492
+ },
7493
+ {
7494
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7495
+ name: "Zimbi",
7496
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7497
+ validUntil: null,
7498
+ externalId: "pcQYbPuKGZ7"
7499
+ },
7500
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
7501
+ {
7502
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7503
+ name: "Felani",
7504
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7505
+ validUntil: null,
7506
+ externalId: "gSqpoCGdMXp"
7507
+ },
7508
+ {
7509
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7510
+ name: "Goroma",
7511
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7512
+ validUntil: null,
7513
+ externalId: "KvAAIaNqVrp"
7514
+ },
7515
+ {
7516
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7517
+ name: "Halifu",
7518
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7519
+ validUntil: null,
7520
+ externalId: "qe4UnEVt1hv"
7521
+ },
7522
+ {
7523
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7524
+ name: "Jabari",
7525
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7526
+ validUntil: null,
7527
+ externalId: "yHH9Nz4rLOt"
7528
+ },
7529
+ {
7530
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7531
+ name: "Kifani",
7532
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7533
+ validUntil: null,
7534
+ externalId: "eSWmXIGeu1I"
7535
+ },
7536
+ {
7537
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7538
+ name: "Lumela",
7539
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7540
+ validUntil: null,
7541
+ externalId: "bh0b3aI1uP3"
7542
+ }
7543
+ ];
7544
+ var V2_DEFAULT_MOCK_LOCATIONS = [
7545
+ {
7546
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7547
+ name: "Central Provincial Office",
7548
+ locationType: "CRVS_OFFICE",
7549
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7550
+ validUntil: null,
7551
+ externalId: "Xr3Df8WpK6Ys"
7552
+ },
7553
+ {
7554
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7555
+ name: "Central Health Post",
7556
+ locationType: "HEALTH_FACILITY",
7557
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7558
+ validUntil: null
7559
+ },
7560
+ {
7561
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7562
+ name: "Ibombo District Office",
7563
+ locationType: "CRVS_OFFICE",
7564
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7565
+ validUntil: null,
7566
+ externalId: "Sm4Nw7GrD2Vy"
7567
+ },
7568
+ {
7569
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
7570
+ name: "Isamba District Office",
7571
+ locationType: "CRVS_OFFICE",
7572
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7573
+ validUntil: null,
7574
+ externalId: "Vg1Bq5XeH9Lt"
7575
+ },
7576
+ {
7577
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
7578
+ name: "Isango District Office",
7579
+ locationType: "CRVS_OFFICE",
7580
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7581
+ validUntil: null,
7582
+ externalId: "Je7Lm2XqN9Vz"
7583
+ },
7584
+ {
7585
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
7586
+ name: "Sulaka Provincial Office",
7587
+ locationType: "CRVS_OFFICE",
7588
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7589
+ validUntil: null,
7590
+ externalId: "Ht2Wp9KcX5Qv"
7591
+ },
7592
+ {
7593
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
7594
+ name: "Ilanga District Office",
7595
+ locationType: "CRVS_OFFICE",
7596
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7597
+ validUntil: null,
7598
+ externalId: "Yp6Ds1WqN3Xz"
7599
+ },
7600
+ {
7601
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
7602
+ name: "Chamakubi Health Post",
7603
+ locationType: "HEALTH_FACILITY",
7604
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7605
+ validUntil: null,
7606
+ externalId: "M1nFr8LbC2Qy"
7607
+ },
7608
+ {
7609
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
7610
+ name: "Ibombo Rural Health Centre",
7611
+ locationType: "HEALTH_FACILITY",
7612
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7613
+ validUntil: null,
7614
+ externalId: "bT7pV6YrW0Xc"
7615
+ },
7616
+ {
7617
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
7618
+ name: "Chikobo Rural Health Centre",
7619
+ locationType: "HEALTH_FACILITY",
7620
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7621
+ validUntil: null,
7622
+ externalId: "zE4qPn2SgJ5d"
7623
+ },
7624
+ {
7625
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
7626
+ name: "Chilochabalenje Health Post",
7627
+ locationType: "HEALTH_FACILITY",
7628
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7629
+ validUntil: null,
7630
+ externalId: "H8vDs1MqR4Uf"
7631
+ },
7632
+ {
7633
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
7634
+ name: "Chipeso Rural Health Centre",
7635
+ locationType: "HEALTH_FACILITY",
7636
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7637
+ validUntil: null,
7638
+ externalId: "Qw3uZ9KfX6Lm"
7639
+ },
7640
+ {
7641
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
7642
+ name: "Chisamba Rural Health Centre",
7643
+ locationType: "HEALTH_FACILITY",
7644
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7645
+ validUntil: null,
7646
+ externalId: "Yr0pCg8LdM2s"
7647
+ },
7648
+ {
7649
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
7650
+ name: "Chitanda Rural Health Centre",
7651
+ locationType: "HEALTH_FACILITY",
7652
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7653
+ validUntil: null,
7654
+ externalId: "tS9gJ4PwB1Qx"
7655
+ },
7656
+ {
7657
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
7658
+ name: "Golden Valley Rural Health Centre",
7659
+ locationType: "HEALTH_FACILITY",
7660
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7661
+ validUntil: null,
7662
+ externalId: "Ld7Qm3XsA8Vr"
7663
+ },
7664
+ {
7665
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
7666
+ name: "Ipongo Rural Health Centre",
7667
+ locationType: "HEALTH_FACILITY",
7668
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7669
+ validUntil: null,
7670
+ externalId: "kF2sW9DmH0Bt"
7671
+ },
7672
+ {
7673
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
7674
+ name: "Itumbwe Health Post",
7675
+ locationType: "HEALTH_FACILITY",
7676
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7677
+ validUntil: null,
7678
+ externalId: "Ue5Xb3VaC7Pq"
7679
+ },
7680
+ {
7681
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
7682
+ name: "Kabangalala Rural Health Centre",
7683
+ locationType: "HEALTH_FACILITY",
7684
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7685
+ validUntil: null,
7686
+ externalId: "Pz8Kc1TqH6Jn"
7687
+ },
7688
+ // Village offices
7689
+ {
7690
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
7691
+ name: "Klow Village Office",
7692
+ locationType: "CRVS_OFFICE",
7693
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7694
+ validUntil: null,
7695
+ externalId: "PmAyxAJkxiJ"
7696
+ }
7697
+ ];
7698
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7699
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7700
+ );
7701
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7702
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7703
+ );
7704
+
6953
7705
  // ../commons/src/notification/UserNotifications.ts
6954
7706
  var z44 = __toESM(require("zod/v4"));
6955
7707
  var TriggerEvent = {