@opencrvs/toolkit 2.0.0-rc.a0ce994 → 2.0.0-rc.a0fc425

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 (52) hide show
  1. package/create-countryconfig/index.js +103 -0
  2. package/create-countryconfig/package.json +21 -0
  3. package/dist/application-config/index.js +267 -120
  4. package/dist/cli.js +397 -131
  5. package/dist/commons/api/router.d.ts +3331 -266
  6. package/dist/commons/application-config/index.d.ts +1 -0
  7. package/dist/commons/conditionals/conditionals.d.ts +357 -7
  8. package/dist/commons/conditionals/validate.d.ts +52 -2
  9. package/dist/commons/events/ActionInput.d.ts +108 -0
  10. package/dist/commons/events/Draft.d.ts +4 -2
  11. package/dist/commons/events/EventIndex.d.ts +0 -3
  12. package/dist/commons/events/EventMetadata.d.ts +0 -7
  13. package/dist/commons/events/FieldConfig.d.ts +382 -50
  14. package/dist/commons/events/FieldValue.d.ts +6 -0
  15. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  16. package/dist/commons/events/field.d.ts +47 -1
  17. package/dist/commons/events/index.d.ts +2 -0
  18. package/dist/commons/events/locations.d.ts +21 -0
  19. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  20. package/dist/commons/events/scopes.d.ts +24 -1
  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 +0 -2
  24. package/dist/commons/events/utils.d.ts +2 -2
  25. package/dist/conditionals/index.js +60 -5
  26. package/dist/events/index.js +976 -249
  27. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  28. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  30. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  31. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  32. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  33. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  34. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  35. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  36. package/dist/migrations/v2.0/index.d.ts +5 -3
  37. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  38. package/dist/migrations/v2.0/index.js +395 -129
  39. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  40. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  41. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  42. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  44. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  46. package/dist/notification/index.js +802 -154
  47. package/dist/scopes/index.d.ts +6 -1
  48. package/dist/scopes/index.js +8 -4
  49. package/opencrvs-toolkit-2.0.0-rc.a0fc425.tgz +0 -0
  50. package/package.json +6 -2
  51. package/tsconfig.tsbuildinfo +1 -1
  52. package/opencrvs-toolkit-2.0.0-rc.a0ce994.tgz +0 -0
@@ -226,12 +226,14 @@ var SystemScopeType = z2.enum([
226
226
  "organisation.read-locations",
227
227
  "user.read",
228
228
  "user.create",
229
- "user.edit"
229
+ "user.edit",
230
+ "user.search"
230
231
  ]);
231
232
  var UserScopeType = SystemScopeType.extract([
232
233
  "user.read",
233
234
  "user.create",
234
- "user.edit"
235
+ "user.edit",
236
+ "user.search"
235
237
  ]);
236
238
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
237
239
  var UserScopeV2 = z2.discriminatedUnion("type", [
@@ -240,7 +242,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
240
242
  options: AllUserScopeOptions.optional()
241
243
  }),
242
244
  z2.object({
243
- type: UserScopeType.extract(["user.read"]),
245
+ type: UserScopeType.extract(["user.read", "user.search"]),
244
246
  options: AccessLevelOptions.optional()
245
247
  })
246
248
  ]);
@@ -291,7 +293,9 @@ var ScopeType = z2.enum([
291
293
  var EncodedScope = z2.string().brand("EncodedScope");
292
294
  var DEFAULT_SCOPE_OPTIONS = {
293
295
  placeOfEvent: JurisdictionFilter.enum.all,
294
- accessLevel: JurisdictionFilter.enum.all
296
+ accessLevel: JurisdictionFilter.enum.all,
297
+ registeredIn: JurisdictionFilter.enum.all,
298
+ declaredIn: JurisdictionFilter.enum.all
295
299
  };
296
300
 
297
301
  // ../commons/src/authentication.ts
@@ -650,7 +654,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
650
654
  ShowConditional,
651
655
  // Action can be shown to the user in the list but as disabled
652
656
  EnableConditional
653
- ]);
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
+ });
654
661
  var DisplayOnReviewConditional = z7.object({
655
662
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
656
663
  conditional: Conditional
@@ -665,8 +672,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
665
672
  // Field output can be shown / hidden on the review page
666
673
  DisplayOnReviewConditional
667
674
  ]).meta({
668
- description: "Field conditional configuration",
669
- 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."
670
677
  });
671
678
 
672
679
  // ../commons/src/events/FieldType.ts
@@ -910,6 +917,7 @@ var DateRangeFieldValue = z12.object({
910
917
  var EmailValue = z12.email();
911
918
  var CheckboxFieldValue = z12.boolean();
912
919
  var NumberFieldValue = z12.number();
920
+ var SignatureFieldValue = FileFieldValue;
913
921
  var ButtonFieldValue = z12.number();
914
922
  var VerificationStatusValue = z12.enum([
915
923
  "verified",
@@ -978,28 +986,20 @@ function schemaPriority(schema) {
978
986
  return idx === -1 ? 9999 : idx;
979
987
  }
980
988
  function safeUnion(schemas) {
989
+ const sortedSchemas = [...schemas].sort(
990
+ (a, b) => schemaPriority(a) - schemaPriority(b)
991
+ );
981
992
  return z12.any().superRefine((val, ctx) => {
982
- const successful = schemas.filter((s) => s.safeParse(val).success);
983
- if (successful.length === 1) {
984
- return;
985
- }
986
- if (successful.length === 0) {
987
- ctx.addIssue({
988
- code: "invalid_type",
989
- expected: "custom",
990
- message: "Value does not match any schema"
991
- });
992
- return;
993
- }
994
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
995
- const best = successful[0];
996
- if (!best.safeParse(val).success) {
997
- ctx.addIssue({
998
- expected: "custom",
999
- code: "invalid_type",
1000
- message: "Value did not match the best schema"
1001
- });
993
+ for (const schema of sortedSchemas) {
994
+ if (schema.safeParse(val).success) {
995
+ return;
996
+ }
1002
997
  }
998
+ ctx.addIssue({
999
+ code: "invalid_type",
1000
+ expected: "custom",
1001
+ message: "Value does not match any schema"
1002
+ });
1003
1003
  }).meta({
1004
1004
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1005
1005
  });
@@ -1309,6 +1309,9 @@ var FlagConfig = z15.object({
1309
1309
  "Indicates if this flag expects an action to be performed to be cleared."
1310
1310
  ),
1311
1311
  label: TranslationConfig.describe("Human readable label of the flag.")
1312
+ }).meta({
1313
+ id: "FlagConfig",
1314
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1312
1315
  });
1313
1316
  var ActionFlagConfig = z15.object({
1314
1317
  id: Flag,
@@ -1316,6 +1319,9 @@ var ActionFlagConfig = z15.object({
1316
1319
  conditional: Conditional.optional().describe(
1317
1320
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1318
1321
  )
1322
+ }).meta({
1323
+ id: "ActionFlagConfig",
1324
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1319
1325
  });
1320
1326
 
1321
1327
  // ../commons/src/events/EventMetadata.ts
@@ -1337,8 +1343,7 @@ var ActionCreationMetadata = z16.object({
1337
1343
  ),
1338
1344
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1339
1345
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1340
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1341
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1346
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1342
1347
  });
1343
1348
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1344
1349
  registrationNumber: z16.string().describe(
@@ -1366,9 +1371,6 @@ var EventMetadata = z16.object({
1366
1371
  createdAtLocation: UUID.nullish().describe(
1367
1372
  "Location of the user who created the event."
1368
1373
  ),
1369
- createdBySignature: DocumentPath.nullish().describe(
1370
- "Signature of the user who created the event."
1371
- ),
1372
1374
  updatedAtLocation: UUID.nullish().describe(
1373
1375
  "Location of the user who last changed the status."
1374
1376
  ),
@@ -1661,14 +1663,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1661
1663
  }
1662
1664
  }).describe("Unique identifier for the field");
1663
1665
  var FieldReference = import_v43.default.object({
1664
- $$field: FieldId,
1666
+ $$field: FieldId.describe("Id of the field to reference"),
1665
1667
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1666
1668
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1669
+ ),
1670
+ $$code: import_v43.default.string().optional().describe(
1671
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1667
1672
  )
1668
- }).describe("Reference to a field by its ID");
1673
+ }).describe(
1674
+ "Reference to a field value, with an optional client-side computation applied."
1675
+ );
1676
+ var ComputedDefaultValue = import_v43.default.object({
1677
+ $$code: import_v43.default.string().describe(
1678
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1679
+ )
1680
+ }).describe("A context-only computation used as a field default value.");
1669
1681
  var ValidationConfig = import_v43.default.object({
1670
- validator: Conditional,
1671
- message: TranslationConfig
1682
+ validator: Conditional.describe(
1683
+ "Conditional expression that must hold for the field value to be considered valid."
1684
+ ),
1685
+ message: TranslationConfig.describe(
1686
+ "Error message displayed when the validator does not hold."
1687
+ )
1688
+ }).meta({
1689
+ id: "ValidationConfig",
1690
+ 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."
1672
1691
  });
1673
1692
  var requiredSchema = import_v43.default.union([
1674
1693
  import_v43.default.boolean(),
@@ -1699,7 +1718,7 @@ var BaseField = import_v43.default.object({
1699
1718
  "Indicates whether the field can be modified during record correction."
1700
1719
  ),
1701
1720
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1702
- "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."
1721
+ "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."
1703
1722
  ),
1704
1723
  analytics: import_v43.default.boolean().default(false).optional().describe(
1705
1724
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1707,30 +1726,39 @@ var BaseField = import_v43.default.object({
1707
1726
  }).describe("Common properties shared across all field types.");
1708
1727
  var Divider = BaseField.extend({
1709
1728
  type: import_v43.default.literal(FieldType.DIVIDER)
1729
+ }).meta({
1730
+ description: "A horizontal line divider",
1731
+ id: "Divider"
1710
1732
  });
1711
1733
  var TextField = BaseField.extend({
1712
1734
  type: import_v43.default.literal(FieldType.TEXT),
1713
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1735
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1714
1736
  configuration: import_v43.default.object({
1715
1737
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1716
1738
  type: import_v43.default.enum(["text", "password"]).optional(),
1717
1739
  prefix: TranslationConfig.optional(),
1718
1740
  postfix: TranslationConfig.optional()
1719
1741
  }).default({ type: "text" }).optional()
1720
- }).describe("Text input");
1742
+ }).meta({
1743
+ description: "A text input field",
1744
+ id: "TextField"
1745
+ });
1721
1746
  var NumberField = BaseField.extend({
1722
1747
  type: import_v43.default.literal(FieldType.NUMBER),
1723
- defaultValue: NumberFieldValue.optional(),
1748
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1724
1749
  configuration: import_v43.default.object({
1725
1750
  min: import_v43.default.number().optional().describe("Minimum value"),
1726
1751
  max: import_v43.default.number().optional().describe("Maximum value"),
1727
1752
  prefix: TranslationConfig.optional(),
1728
1753
  postfix: TranslationConfig.optional()
1729
1754
  }).optional()
1730
- }).describe("Number input");
1755
+ }).meta({
1756
+ description: "A number input field",
1757
+ id: "NumberField"
1758
+ });
1731
1759
  var TextAreaField = BaseField.extend({
1732
1760
  type: import_v43.default.literal(FieldType.TEXTAREA),
1733
- defaultValue: NonEmptyTextValue.optional(),
1761
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1734
1762
  configuration: import_v43.default.object({
1735
1763
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1736
1764
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1738,7 +1766,10 @@ var TextAreaField = BaseField.extend({
1738
1766
  prefix: TranslationConfig.optional(),
1739
1767
  postfix: TranslationConfig.optional()
1740
1768
  }).default({ rows: 4 }).optional()
1741
- }).describe("Multiline text input");
1769
+ }).meta({
1770
+ description: "A multiline text input",
1771
+ id: "TextAreaField"
1772
+ });
1742
1773
  var ImageMimeType = import_v43.default.enum([
1743
1774
  "image/png",
1744
1775
  "image/jpg",
@@ -1761,58 +1792,76 @@ var SignatureField = BaseField.extend({
1761
1792
  signaturePromptLabel: TranslationConfig.describe(
1762
1793
  "Title of the signature modal"
1763
1794
  ),
1764
- defaultValue: FieldValue.optional(),
1795
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1765
1796
  configuration: import_v43.default.object({
1766
1797
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1767
1798
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1768
1799
  }).default({
1769
1800
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1770
1801
  })
1771
- }).describe("Signature input field");
1802
+ }).meta({
1803
+ description: "A signature input field",
1804
+ id: "SignatureField"
1805
+ });
1772
1806
  var EmailField = BaseField.extend({
1773
1807
  type: import_v43.default.literal(FieldType.EMAIL),
1774
1808
  configuration: import_v43.default.object({
1775
1809
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1776
1810
  }).default({ maxLength: 255 }).optional(),
1777
- defaultValue: NonEmptyTextValue.optional()
1811
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1812
+ }).meta({
1813
+ description: "An email input field",
1814
+ id: "EmailField"
1778
1815
  });
1779
1816
  var DateField = BaseField.extend({
1780
1817
  type: import_v43.default.literal(FieldType.DATE),
1781
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1818
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1782
1819
  configuration: import_v43.default.object({
1783
1820
  notice: TranslationConfig.describe(
1784
1821
  "Text to display above the date input"
1785
1822
  ).optional()
1786
1823
  }).optional()
1787
- }).describe("A single date input (yyyy-MM-dd)");
1824
+ }).meta({
1825
+ description: "A date input (yyyy-MM-dd)",
1826
+ id: "DateField"
1827
+ });
1788
1828
  var AgeField = BaseField.extend({
1789
1829
  type: import_v43.default.literal(FieldType.AGE),
1790
- defaultValue: NumberFieldValue.optional(),
1830
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1791
1831
  configuration: import_v43.default.object({
1792
1832
  asOfDate: FieldReference,
1793
1833
  prefix: TranslationConfig.optional(),
1794
1834
  postfix: TranslationConfig.optional()
1795
1835
  })
1796
- }).describe("An age input field which uses the current date as the asOfDate");
1836
+ }).meta({
1837
+ description: "An age input field which uses the current date as the asOfDate",
1838
+ id: "AgeField"
1839
+ });
1797
1840
  var TimeField = BaseField.extend({
1798
1841
  type: import_v43.default.literal(FieldType.TIME),
1799
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1842
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1800
1843
  configuration: import_v43.default.object({
1801
1844
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1802
1845
  notice: TranslationConfig.describe(
1803
1846
  "Text to display above the time input"
1804
1847
  ).optional()
1805
1848
  }).optional()
1806
- }).describe("A single date input (HH-mm)");
1849
+ }).meta({
1850
+ description: "A single time input (HH-mm)",
1851
+ id: "TimeField"
1852
+ });
1807
1853
  var DateRangeField = BaseField.extend({
1808
1854
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1809
- defaultValue: DateRangeFieldValue.optional(),
1855
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1810
1856
  configuration: import_v43.default.object({
1811
1857
  notice: TranslationConfig.describe(
1812
1858
  "Text to display above the date input"
1813
1859
  ).optional()
1814
1860
  }).optional()
1815
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1861
+ }).meta({
1862
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1863
+ id: "DateRangeField"
1864
+ });
1816
1865
  var HtmlFontVariant = import_v43.default.enum([
1817
1866
  "reg12",
1818
1867
  "reg14",
@@ -1856,21 +1905,33 @@ var ImageViewField = BaseField.extend({
1856
1905
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1857
1906
  defaultValue: NonEmptyTextValue.optional(),
1858
1907
  configuration: ImageConfiguration
1859
- }).describe("A read-only image component for form pages");
1908
+ }).meta({
1909
+ description: "A read-only image component for form pages",
1910
+ id: "ImageViewField"
1911
+ });
1860
1912
  var Paragraph = BaseField.extend({
1861
1913
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1862
1914
  configuration: ParagraphConfiguration
1863
- }).describe("A read-only HTML <p> paragraph");
1915
+ }).meta({
1916
+ description: "A read-only HTML <p> paragraph",
1917
+ id: "Paragraph"
1918
+ });
1864
1919
  var Heading = BaseField.extend({
1865
1920
  type: import_v43.default.literal(FieldType.HEADING),
1866
1921
  configuration: HeadingConfiguration
1867
- }).describe("A read-only heading component for form pages");
1922
+ }).meta({
1923
+ description: "A read-only heading component for form pages",
1924
+ id: "Heading"
1925
+ });
1868
1926
  var PageHeader = BaseField.extend({
1869
1927
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1870
- }).describe("A read-only header component for form pages");
1928
+ }).meta({
1929
+ description: "A read-only header component for form pages",
1930
+ id: "PageHeader"
1931
+ });
1871
1932
  var File = BaseField.extend({
1872
1933
  type: import_v43.default.literal(FieldType.FILE),
1873
- defaultValue: FileFieldValue.optional(),
1934
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1874
1935
  configuration: import_v43.default.object({
1875
1936
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1876
1937
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1886,7 +1947,10 @@ var File = BaseField.extend({
1886
1947
  }).default({
1887
1948
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1888
1949
  })
1889
- }).describe("File upload");
1950
+ }).meta({
1951
+ description: "A file upload field",
1952
+ id: "File"
1953
+ });
1890
1954
  var SelectOption = import_v43.default.object({
1891
1955
  value: import_v43.default.string().describe("The value of the option"),
1892
1956
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1894,7 +1958,7 @@ var SelectOption = import_v43.default.object({
1894
1958
  });
1895
1959
  var NumberWithUnitField = BaseField.extend({
1896
1960
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1897
- defaultValue: NumberWithUnitFieldValue.optional(),
1961
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1898
1962
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1899
1963
  configuration: import_v43.default.object({
1900
1964
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1903,17 +1967,23 @@ var NumberWithUnitField = BaseField.extend({
1903
1967
  "Placeholder for the number field"
1904
1968
  )
1905
1969
  }).optional()
1906
- }).describe("Number with unit input");
1970
+ }).meta({
1971
+ description: "A number with unit input field",
1972
+ id: "NumberWithUnitField"
1973
+ });
1907
1974
  var RadioGroup = BaseField.extend({
1908
1975
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1909
- defaultValue: TextValue.optional(),
1976
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1910
1977
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1911
1978
  configuration: import_v43.default.object({
1912
1979
  styles: import_v43.default.object({
1913
1980
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1914
1981
  }).optional()
1915
1982
  }).optional()
1916
- }).describe("Grouped radio options");
1983
+ }).meta({
1984
+ description: "A grouped radio button field",
1985
+ id: "RadioGroup"
1986
+ });
1917
1987
  var BulletList = BaseField.extend({
1918
1988
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1919
1989
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1922,10 +1992,13 @@ var BulletList = BaseField.extend({
1922
1992
  fontVariant: HtmlFontVariant.optional()
1923
1993
  }).optional()
1924
1994
  }).default({})
1925
- }).describe("A list of bullet points");
1995
+ }).meta({
1996
+ description: "A list of bullet points",
1997
+ id: "BulletList"
1998
+ });
1926
1999
  var Select = BaseField.extend({
1927
2000
  type: import_v43.default.literal(FieldType.SELECT),
1928
- defaultValue: TextValue.optional(),
2001
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1929
2002
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1930
2003
  noOptionsMessage: TranslationConfig.optional().describe(
1931
2004
  `
@@ -1937,16 +2010,22 @@ var Select = BaseField.extend({
1937
2010
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1938
2011
  `
1939
2012
  )
1940
- }).describe("Select input");
2013
+ }).meta({
2014
+ description: "A select input field",
2015
+ id: "Select"
2016
+ });
1941
2017
  var SelectDateRangeOption = import_v43.default.object({
1942
2018
  value: SelectDateRangeValue.describe("The value of the option"),
1943
2019
  label: TranslationConfig.describe("The label of the option")
1944
2020
  });
1945
2021
  var SelectDateRangeField = BaseField.extend({
1946
2022
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1947
- defaultValue: SelectDateRangeValue.optional(),
2023
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1948
2024
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1949
- }).describe("Select input with date range options");
2025
+ }).meta({
2026
+ description: "A date range selection field",
2027
+ id: "SelectDateRangeField"
2028
+ });
1950
2029
  var NameConfig = import_v43.default.object({
1951
2030
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1952
2031
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1958,7 +2037,7 @@ var NameField = BaseField.extend({
1958
2037
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1959
2038
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1960
2039
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1961
- }).optional(),
2040
+ }).or(ComputedDefaultValue).optional(),
1962
2041
  configuration: import_v43.default.object({
1963
2042
  name: NameConfig.default({
1964
2043
  firstname: { required: true },
@@ -1977,26 +2056,41 @@ var NameField = BaseField.extend({
1977
2056
  surname: { required: true }
1978
2057
  }
1979
2058
  }).optional()
1980
- }).describe("Name input field");
2059
+ }).meta({
2060
+ description: "A field for entering a persons name",
2061
+ id: "NameField"
2062
+ });
1981
2063
  var PhoneField = BaseField.extend({
1982
- defaultValue: NonEmptyTextValue.optional(),
2064
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1983
2065
  type: import_v43.default.literal(FieldType.PHONE)
1984
- }).describe("Phone input field");
2066
+ }).meta({
2067
+ description: "A field for entering a phone number",
2068
+ id: "PhoneField"
2069
+ });
1985
2070
  var IdField = BaseField.extend({
1986
- defaultValue: NonEmptyTextValue.optional(),
2071
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1987
2072
  type: import_v43.default.literal(FieldType.ID)
1988
- }).describe("ID input field");
2073
+ }).meta({
2074
+ description: "A field for entering an ID",
2075
+ id: "IdField"
2076
+ });
1989
2077
  var Checkbox = BaseField.extend({
1990
2078
  type: import_v43.default.literal(FieldType.CHECKBOX),
1991
- defaultValue: CheckboxFieldValue.default(false)
1992
- }).describe("Boolean checkbox field");
2079
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
2080
+ }).meta({
2081
+ description: "A boolean checkbox field",
2082
+ id: "Checkbox"
2083
+ });
1993
2084
  var Country = BaseField.extend({
1994
2085
  type: import_v43.default.literal(FieldType.COUNTRY),
1995
- defaultValue: NonEmptyTextValue.optional(),
2086
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1996
2087
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1997
2088
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1998
2089
  )
1999
- }).describe("Country select field");
2090
+ }).meta({
2091
+ description: "A field for selecting a country",
2092
+ id: "Country"
2093
+ });
2000
2094
  var AllowedLocations = JurisdictionReference.optional().describe(
2001
2095
  "Limits which location options are selectable depending on user jurisdiction and location."
2002
2096
  );
@@ -2005,28 +2099,33 @@ var AdministrativeAreas = import_v43.default.enum([
2005
2099
  "HEALTH_FACILITY",
2006
2100
  "CRVS_OFFICE"
2007
2101
  ]);
2008
- var AdministrativeAreaConfiguration = import_v43.default.object({
2009
- partOf: FieldReference.optional().describe("Parent location"),
2010
- type: AdministrativeAreas,
2011
- allowedLocations: AllowedLocations
2012
- }).describe("Administrative area options");
2013
2102
  var AdministrativeAreaField = BaseField.extend({
2014
2103
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
2015
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2016
- configuration: AdministrativeAreaConfiguration
2017
- }).describe("Administrative area input field e.g. facility, office");
2104
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2105
+ configuration: import_v43.default.object({
2106
+ partOf: FieldReference.optional().describe("Parent location"),
2107
+ type: AdministrativeAreas,
2108
+ allowedLocations: AllowedLocations
2109
+ }).describe("Administrative area options")
2110
+ }).meta({
2111
+ description: "Administrative area input field",
2112
+ id: "AdministrativeAreaField"
2113
+ });
2018
2114
  var LocationInput = BaseField.extend({
2019
2115
  type: import_v43.default.literal(FieldType.LOCATION),
2020
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2116
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2021
2117
  configuration: import_v43.default.object({
2022
2118
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2023
2119
  allowedLocations: AllowedLocations
2024
2120
  }).optional()
2025
- }).describe("Input field for a location");
2121
+ }).meta({
2122
+ description: "A field for selecting a location",
2123
+ id: "LocationInput"
2124
+ });
2026
2125
  var FileUploadWithOptions = BaseField.extend({
2027
2126
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2028
2127
  options: import_v43.default.array(SelectOption).describe("A list of options"),
2029
- defaultValue: FileFieldWithOptionValue.optional(),
2128
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
2030
2129
  configuration: import_v43.default.object({
2031
2130
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2032
2131
  maxImageSize: import_v43.default.object({
@@ -2036,15 +2135,18 @@ var FileUploadWithOptions = BaseField.extend({
2036
2135
  }).default({
2037
2136
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2038
2137
  })
2138
+ }).meta({
2139
+ description: "A field for uploading files with file type options",
2140
+ id: "FileUploadWithOptions"
2039
2141
  });
2040
2142
  var Facility = BaseField.extend({
2041
2143
  type: import_v43.default.literal(FieldType.FACILITY),
2042
- defaultValue: NonEmptyTextValue.optional(),
2144
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2043
2145
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2044
2146
  }).describe("Input field for a facility");
2045
2147
  var Office = BaseField.extend({
2046
2148
  type: import_v43.default.literal(FieldType.OFFICE),
2047
- defaultValue: NonEmptyTextValue.optional(),
2149
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2048
2150
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2049
2151
  }).describe("Input field for an office");
2050
2152
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2080,8 +2182,11 @@ var Address = BaseField.extend({
2080
2182
  ).optional(),
2081
2183
  allowedLocations: AllowedLocations
2082
2184
  }).optional(),
2083
- defaultValue: DefaultAddressFieldValue.optional()
2084
- }).describe("Address input field \u2013 a combination of location and text fields");
2185
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2186
+ }).meta({
2187
+ description: "Address input field \u2013 a combination of location and text fields",
2188
+ id: "Address"
2189
+ });
2085
2190
  var StaticDataEntry = import_v43.default.object({
2086
2191
  id: import_v43.default.string().describe("ID for the data entry."),
2087
2192
  label: TranslationConfig,
@@ -2096,7 +2201,10 @@ var DataField = BaseField.extend({
2096
2201
  subtitle: TranslationConfig.optional(),
2097
2202
  data: import_v43.default.array(DataEntry)
2098
2203
  })
2099
- }).describe("Data field for displaying read-only data");
2204
+ }).meta({
2205
+ description: "A field for displaying a table of read-only data",
2206
+ id: "DataField"
2207
+ });
2100
2208
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2101
2209
  var ButtonType = import_v43.default.enum([
2102
2210
  "primary",
@@ -2121,13 +2229,19 @@ var ButtonConfiguration = import_v43.default.object({
2121
2229
  });
2122
2230
  var ButtonField = BaseField.extend({
2123
2231
  type: import_v43.default.literal(FieldType.BUTTON),
2124
- defaultValue: ButtonFieldValue.optional(),
2232
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
2125
2233
  configuration: ButtonConfiguration
2126
- }).describe("Generic button without any built-in functionality");
2234
+ }).meta({
2235
+ description: "A generic button that can be used to trigger an action",
2236
+ id: "ButtonField"
2237
+ });
2127
2238
  var FieldGroup = BaseField.extend({
2128
2239
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2129
2240
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2130
2241
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2242
+ }).meta({
2243
+ description: "A group of fields that are displayed together",
2244
+ id: "FieldGroup"
2131
2245
  });
2132
2246
  var AlphaPrintButton = BaseField.extend({
2133
2247
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2137,10 +2251,13 @@ var AlphaPrintButton = BaseField.extend({
2137
2251
  "Label for the print button"
2138
2252
  )
2139
2253
  })
2140
- }).describe("Print button field for printing certificates");
2254
+ }).meta({
2255
+ description: "An experimental print button field for printing certificates during the declaration process",
2256
+ id: "AlphaPrintButton"
2257
+ });
2141
2258
  var HttpField = BaseField.extend({
2142
2259
  type: import_v43.default.literal(FieldType.HTTP),
2143
- defaultValue: HttpFieldValue.optional(),
2260
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
2144
2261
  configuration: import_v43.default.object({
2145
2262
  trigger: FieldReference.optional().describe(
2146
2263
  "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."
@@ -2153,20 +2270,30 @@ var HttpField = BaseField.extend({
2153
2270
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2154
2271
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2155
2272
  })
2156
- }).describe("HTTP request function triggered by a button click or other event");
2273
+ }).meta({
2274
+ 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.",
2275
+ id: "HttpField"
2276
+ });
2157
2277
  var AutocompleteField = BaseField.extend({
2158
2278
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2159
2279
  configuration: import_v43.default.object({
2160
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2280
+ url: import_v43.default.string().describe(
2281
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2282
+ ).optional(),
2161
2283
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2162
2284
  defaultOptions: import_v43.default.array(
2163
2285
  import_v43.default.object({
2164
2286
  label: import_v43.default.string(),
2165
2287
  value: import_v43.default.string()
2166
2288
  })
2167
- ).optional()
2289
+ ).optional().describe(
2290
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2291
+ )
2168
2292
  })
2169
- }).describe("Autocomplete input field");
2293
+ }).meta({
2294
+ 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.",
2295
+ id: "AutocompleteField"
2296
+ });
2170
2297
  var SearchField = HttpField.extend({
2171
2298
  type: import_v43.default.literal(FieldType.SEARCH),
2172
2299
  configuration: SearchQuery.pick({
@@ -2199,6 +2326,9 @@ var SearchField = HttpField.extend({
2199
2326
  ok: TranslationConfig.optional()
2200
2327
  }).optional()
2201
2328
  })
2329
+ }).meta({
2330
+ description: "A search input field",
2331
+ id: "SearchField"
2202
2332
  });
2203
2333
  var LinkButtonField = BaseField.extend({
2204
2334
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2207,28 +2337,35 @@ var LinkButtonField = BaseField.extend({
2207
2337
  text: TranslationConfig.describe("Text to display on the button"),
2208
2338
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2209
2339
  })
2210
- }).describe("Button that opens a link");
2340
+ }).meta({
2341
+ description: "A button that opens a URL link",
2342
+ id: "LinkButtonField"
2343
+ });
2211
2344
  var VerificationStatus = BaseField.extend({
2212
2345
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2213
- defaultValue: VerificationStatusValue.optional(),
2346
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
2214
2347
  configuration: import_v43.default.object({
2215
2348
  status: TranslationConfig.describe("Text to display on the status pill."),
2216
2349
  description: TranslationConfig.describe(
2217
2350
  "Explaining text on the banner in form."
2218
2351
  )
2219
2352
  })
2353
+ }).meta({
2354
+ 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.",
2355
+ id: "VerificationStatus"
2220
2356
  });
2221
2357
  var QueryParamReaderField = BaseField.extend({
2222
2358
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2223
2359
  configuration: import_v43.default.object({
2224
2360
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2225
2361
  })
2226
- }).describe(
2227
- "A field that maps URL query params into form values and clears them afterward"
2228
- );
2362
+ }).meta({
2363
+ description: "A field that maps URL query params into form values and clears them afterward",
2364
+ id: "QueryParamReaderField"
2365
+ });
2229
2366
  var QrReaderField = BaseField.extend({
2230
2367
  type: import_v43.default.literal(FieldType.QR_READER),
2231
- defaultValue: QrReaderFieldValue.optional(),
2368
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
2232
2369
  configuration: import_v43.default.object({
2233
2370
  validator: import_v43.default.any().meta({
2234
2371
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -2236,21 +2373,27 @@ var QrReaderField = BaseField.extend({
2236
2373
  })
2237
2374
  }).optional()
2238
2375
  }).meta({
2239
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2376
+ description: "QR code reader field, including optional JSON Schema validator.",
2240
2377
  id: "QrReaderField"
2241
2378
  });
2242
2379
  var IdReaderField = BaseField.extend({
2243
2380
  type: import_v43.default.literal(FieldType.ID_READER),
2244
- defaultValue: IdReaderFieldValue.optional(),
2381
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
2245
2382
  methods: import_v43.default.array(
2246
2383
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2247
2384
  )
2385
+ }).meta({
2386
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2387
+ id: "IdReaderField"
2248
2388
  });
2249
2389
  var CustomField = BaseField.extend({
2250
2390
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2251
2391
  defaultValue: CustomFieldValue.optional(),
2252
2392
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2253
2393
  configuration: import_v43.default.unknown().optional()
2394
+ }).meta({
2395
+ description: "An expiremental custom field that is defined by a module source path",
2396
+ id: "CustomField"
2254
2397
  });
2255
2398
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2256
2399
  var LoaderField = BaseField.extend({
@@ -2260,22 +2403,25 @@ var LoaderField = BaseField.extend({
2260
2403
  configuration: import_v43.default.object({
2261
2404
  text: TranslationConfig.describe("Display text above the loading spinner")
2262
2405
  })
2263
- }).describe(
2264
- "A non-interactive field that indicates an in progress operation in form"
2265
- );
2406
+ }).meta({
2407
+ description: "A non-interactive field that indicates an in progress operation in form",
2408
+ id: "LoaderField"
2409
+ });
2266
2410
  var HiddenField = BaseField.extend({
2267
2411
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2268
2412
  required: import_v43.default.boolean().default(false).optional(),
2269
2413
  defaultValue: TextValue.optional()
2270
- }).describe(
2271
- "A non-interactive, hidden field that only hold a value in the form"
2272
- );
2414
+ }).meta({
2415
+ description: "A non-interactive, hidden field that only hold a value in the form",
2416
+ id: "HiddenField"
2417
+ });
2273
2418
  var UserRoleField = BaseField.extend({
2274
2419
  type: import_v43.default.literal(FieldType.USER_ROLE),
2275
2420
  defaultValue: TextValue.optional()
2276
- }).describe(
2277
- "A select dropdown that is automatically populated with available user roles"
2278
- );
2421
+ }).meta({
2422
+ description: "A select dropdown that is automatically populated with available user roles",
2423
+ id: "UserRoleField"
2424
+ });
2279
2425
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2280
2426
  FieldGroup,
2281
2427
  Address,
@@ -2374,16 +2520,19 @@ var VerificationPageConfig = FormPageConfig.extend({
2374
2520
  type: z21.literal(PageTypes.enum.VERIFICATION),
2375
2521
  actions: VerificationActionConfig
2376
2522
  });
2377
- var PageConfig = z21.discriminatedUnion("type", [
2378
- FormPageConfig,
2379
- VerificationPageConfig
2380
- ]);
2523
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2524
+ id: "PageConfig",
2525
+ 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."
2526
+ });
2381
2527
 
2382
2528
  // ../commons/src/events/FormConfig.ts
2383
2529
  var DeclarationFormConfig = z22.object({
2384
2530
  label: TranslationConfig.describe("Human readable description of the form"),
2385
2531
  pages: z22.array(FormPageConfig)
2386
- }).describe("Configuration of the declaration form.");
2532
+ }).meta({
2533
+ id: "DeclarationFormConfig",
2534
+ description: "Configuration of the declaration form."
2535
+ });
2387
2536
  var ActionFormConfig = z22.object({
2388
2537
  label: TranslationConfig.describe("Human readable description of the form"),
2389
2538
  pages: z22.array(PageConfig)
@@ -2483,6 +2632,9 @@ var DeduplicationConfig = z23.object({
2483
2632
  id: z23.string(),
2484
2633
  label: TranslationConfig,
2485
2634
  query: Clause
2635
+ }).meta({
2636
+ id: "DeduplicationConfig",
2637
+ 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."
2486
2638
  });
2487
2639
 
2488
2640
  // ../commons/src/events/ActionConfig.ts
@@ -2600,17 +2752,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
2600
2752
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2601
2753
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2602
2754
  */
2603
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2604
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2605
- RejectConfig.meta({ id: "RejectActionConfig" }),
2606
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2755
+ ReadActionConfig.meta({
2756
+ id: "ReadActionConfig",
2757
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2758
+ }),
2759
+ DeclareConfig.meta({
2760
+ id: "DeclareActionConfig",
2761
+ description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2762
+ }),
2763
+ RejectConfig.meta({
2764
+ id: "RejectActionConfig",
2765
+ description: "Configuration for rejecting a record before registration."
2766
+ }),
2767
+ RegisterConfig.meta({
2768
+ id: "RegisterActionConfig",
2769
+ description: "Configuration for registering a record."
2770
+ }),
2607
2771
  PrintCertificateActionConfig.meta({
2608
- id: "PrintCertificateActionConfig"
2772
+ id: "PrintCertificateActionConfig",
2773
+ description: "Configuration for printing a certificate of a registered record."
2609
2774
  }),
2610
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2611
- EditActionConfig.meta({ id: "EditActionConfig" }),
2612
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2613
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2775
+ RequestCorrectionConfig.meta({
2776
+ id: "RequestCorrectionActionConfig",
2777
+ description: "Configuration for requesting a correction on a registered record."
2778
+ }),
2779
+ EditActionConfig.meta({
2780
+ id: "EditActionConfig",
2781
+ description: "Configuration for editing a record before registration."
2782
+ }),
2783
+ ArchiveConfig.meta({
2784
+ id: "ArchiveActionConfig",
2785
+ description: "Configuration for archiving a record."
2786
+ }),
2787
+ CustomActionConfig.meta({
2788
+ id: "CustomActionConfig",
2789
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
2790
+ })
2614
2791
  ]).describe(
2615
2792
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2616
2793
  ).meta({ id: "ActionConfig" });
@@ -2686,7 +2863,10 @@ var Field = BaseField2.extend({
2686
2863
  }).describe("Custom field defined for the summary view.");
2687
2864
  var SummaryConfig = z27.object({
2688
2865
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2689
- }).describe("Configuration of the event summary section.");
2866
+ }).meta({
2867
+ id: "SummaryConfig",
2868
+ 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."
2869
+ });
2690
2870
 
2691
2871
  // ../commons/src/events/AdvancedSearchConfig.ts
2692
2872
  var z28 = __toESM(require("zod/v4"));
@@ -2810,6 +2990,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
2810
2990
  var AdvancedSearchConfig = z28.object({
2811
2991
  title: TranslationConfig.describe("Advanced search tab title"),
2812
2992
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2993
+ }).meta({
2994
+ id: "AdvancedSearchConfig",
2995
+ 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()`)."
2813
2996
  });
2814
2997
 
2815
2998
  // ../commons/src/events/utils.ts
@@ -2860,7 +3043,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
2860
3043
  }
2861
3044
  return current;
2862
3045
  }
3046
+ function todayISO() {
3047
+ return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3048
+ }
3049
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
3050
+ function compileClientFunction(code) {
3051
+ let fn = compiledFunctionCache.get(code);
3052
+ if (!fn) {
3053
+ fn = new Function(`return (${code})`)();
3054
+ compiledFunctionCache.set(code, fn);
3055
+ }
3056
+ return fn;
3057
+ }
2863
3058
  (0, import_ajv_formats.default)(ajv);
3059
+ function buildClientFunctionContext(input) {
3060
+ return {
3061
+ $form: input.form,
3062
+ $now: todayISO(),
3063
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3064
+ $online: isOnline(),
3065
+ $user: input.validatorContext?.user,
3066
+ $event: input.validatorContext?.event,
3067
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3068
+ user: input.systemVariables?.user,
3069
+ $window: input.systemVariables?.$window,
3070
+ locations: input.locations,
3071
+ adminLevelIds: input.adminLevelIds
3072
+ };
3073
+ }
3074
+ function runClientFunction(code, data, context) {
3075
+ return compileClientFunction(code)(data, context);
3076
+ }
2864
3077
  ajv.addKeyword({
2865
3078
  keyword: "daysFromDate",
2866
3079
  type: "string",
@@ -2905,12 +3118,35 @@ ajv.addKeyword({
2905
3118
  $data: true,
2906
3119
  errors: true,
2907
3120
  // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
2908
- validate(schema, data, _2, dataContext) {
3121
+ validate(_schema, data, _2, dataContext) {
2909
3122
  const locationIdInput = data;
2910
3123
  const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
2911
3124
  return locations.some((location) => location.id === locationIdInput);
2912
3125
  }
2913
3126
  });
3127
+ ajv.addKeyword({
3128
+ keyword: "customClientValidator",
3129
+ schemaType: "object",
3130
+ errors: true,
3131
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3132
+ // `validate()` callers build root data via `buildClientFunctionContext`,
3133
+ // so the cast holds.
3134
+ validate(schema, data, _2, dataContext) {
3135
+ return Boolean(
3136
+ runClientFunction(
3137
+ schema.code,
3138
+ data,
3139
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3140
+ )
3141
+ );
3142
+ }
3143
+ });
3144
+ function isOnline() {
3145
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3146
+ return navigator.onLine;
3147
+ }
3148
+ return true;
3149
+ }
2914
3150
 
2915
3151
  // ../commons/src/utils.ts
2916
3152
  var z32 = __toESM(require("zod/v4"));
@@ -3529,7 +3765,54 @@ function createFieldConditionals(fieldId) {
3529
3765
  }
3530
3766
  },
3531
3767
  required: [fieldId]
3532
- })
3768
+ }),
3769
+ /**
3770
+ * Custom client-side validator. The provided function is serialised and executed
3771
+ * just-in-time on the client only. External references (e.g. lodash) are not
3772
+ * available inside the function body — all logic must be self-contained.
3773
+ *
3774
+ * @example
3775
+ * field('nid').customClientValidator((value) => {
3776
+ * // LUHN check — all logic must be inline
3777
+ * const digits = String(value).split('').map(Number)
3778
+ * // ...
3779
+ * return isValid
3780
+ * })
3781
+ */
3782
+ customClientValidator(validationFn) {
3783
+ const code = validationFn.toString();
3784
+ return defineFormConditional({
3785
+ type: "object",
3786
+ properties: wrapToPath(
3787
+ { [fieldId]: { customClientValidator: { code } } },
3788
+ this.$$subfield
3789
+ ),
3790
+ required: [fieldId]
3791
+ });
3792
+ },
3793
+ /**
3794
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
3795
+ * that can be used as the `value` property or a DATA component entry.
3796
+ * The function receives the referenced field's value as the first argument and
3797
+ * the full form context as the second; its return value replaces the field reference.
3798
+ * The function is serialised and executed just-in-time on the client only.
3799
+ * External references (e.g. lodash) are not available inside the function body.
3800
+ *
3801
+ * For computing a default value without referencing a specific field, use
3802
+ * `evaluate(fn)` in the `defaultValue` property instead.
3803
+ *
3804
+ * @example
3805
+ * field('a').customClientEvaluation((aValue, ctx) =>
3806
+ * Number(aValue) + Number(ctx.$form.b)
3807
+ * )
3808
+ */
3809
+ customClientEvaluation(computationFn) {
3810
+ return {
3811
+ $$code: computationFn.toString(),
3812
+ $$field: fieldId,
3813
+ $$subfield: this.$$subfield
3814
+ };
3815
+ }
3533
3816
  };
3534
3817
  }
3535
3818
 
@@ -3677,7 +3960,7 @@ var _EventConfigBase = z33.object({
3677
3960
  ),
3678
3961
  label: TranslationConfig.describe("Human-readable label for the event type."),
3679
3962
  actions: z33.array(ActionConfig).describe(
3680
- "Configuration of system-defined actions associated with the event."
3963
+ "Configuration of core and custom actions associated with the event."
3681
3964
  ),
3682
3965
  actionOrder: z33.array(z33.string()).optional().describe(
3683
3966
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3689,7 +3972,7 @@ var _EventConfigBase = z33.object({
3689
3972
  "Configuration of fields available in the advanced search feature."
3690
3973
  ),
3691
3974
  flags: z33.array(FlagConfig).optional().default([]).describe(
3692
- "Configuration of flags associated with the actions of this event type."
3975
+ "Configuration of custom flags associated with the actions of this event type."
3693
3976
  ),
3694
3977
  analytics: z33.boolean().optional().default(true).describe(
3695
3978
  "Indicates whether the records of this event type are included in analytics"
@@ -3702,8 +3985,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
3702
3985
  validateActionFlags(event2, ctx);
3703
3986
  validateActionOrder(event2, ctx);
3704
3987
  }).meta({
3705
- id: "EventConfig"
3706
- }).describe("Configuration defining an event type.");
3988
+ id: "EventConfig",
3989
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
3990
+ });
3707
3991
 
3708
3992
  // ../commons/src/events/EventConfigInput.ts
3709
3993
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -3925,6 +4209,9 @@ var WorkqueueColumnValue = z34.object({
3925
4209
  var WorkqueueColumn = z34.object({
3926
4210
  label: TranslationConfig,
3927
4211
  value: WorkqueueColumnValue
4212
+ }).meta({
4213
+ id: "WorkqueueColumn",
4214
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
3928
4215
  });
3929
4216
  function defineWorkqueuesColumns(workqueueColumns) {
3930
4217
  return workqueueColumns.map(
@@ -4127,18 +4414,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4127
4414
  query: true,
4128
4415
  columns: true
4129
4416
  });
4130
- var WorkqueueConfigInput = z37.object({
4131
- slug: z37.string().describe("Determines the url of the workqueue."),
4132
- name: TranslationConfig.describe(
4133
- "Title of the workflow (both in navigation and on the page)"
4134
- ),
4135
- query: CountryConfigQueryInputType,
4136
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4137
- "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."
4138
- ),
4139
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4140
- icon: AvailableIcons,
4141
- emptyMessage: TranslationConfig.optional()
4417
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4418
+ query: CountryConfigQueryInputType
4419
+ }).meta({
4420
+ id: "WorkqueueConfig",
4421
+ 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."
4142
4422
  });
4143
4423
  var WorkqueueCountInput = z37.array(
4144
4424
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4178,6 +4458,11 @@ var BaseActionInput = z38.object({
4178
4458
  originalActionId: UUID.optional(),
4179
4459
  // should not be part of base action.
4180
4460
  keepAssignment: z38.boolean().optional(),
4461
+ keepAssignmentIfAccepted: z38.boolean().optional(),
4462
+ keepAssignmentIfRejected: z38.boolean().optional(),
4463
+ waitFor: z38.boolean().default(true).describe(
4464
+ "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."
4465
+ ),
4181
4466
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4182
4467
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4183
4468
  createdAtLocation: UUID.nullish().describe(
@@ -4357,7 +4642,7 @@ var Draft = z39.object({
4357
4642
  }).describe(
4358
4643
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4359
4644
  );
4360
- var DraftInput = BaseActionInput.extend({
4645
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4361
4646
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4362
4647
  status: z39.enum([
4363
4648
  ActionStatus.Requested,
@@ -6955,6 +7240,369 @@ var ACTION_FILTERS = {
6955
7240
  // ../commons/src/events/FileUtils.ts
6956
7241
  var import_lodash7 = require("lodash");
6957
7242
 
7243
+ // ../commons/src/events/mocks.test.utils.ts
7244
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7245
+ {
7246
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7247
+ name: "Central",
7248
+ parentId: null,
7249
+ validUntil: null,
7250
+ externalId: "ydyJb1RAy4U1"
7251
+ },
7252
+ {
7253
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7254
+ name: "Sulaka",
7255
+ parentId: null,
7256
+ validUntil: null,
7257
+ externalId: "pQ8nGxWmZ2Q3"
7258
+ },
7259
+ {
7260
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7261
+ name: "Pualula",
7262
+ parentId: null,
7263
+ validUntil: null,
7264
+ externalId: "Aq91DweLmT8k"
7265
+ },
7266
+ {
7267
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7268
+ name: "Chuminga",
7269
+ parentId: null,
7270
+ validUntil: null,
7271
+ externalId: "Rw0fYNh2Xk9a"
7272
+ },
7273
+ {
7274
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7275
+ name: "Ibombo",
7276
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7277
+ validUntil: null,
7278
+ externalId: "k7DsP4vbN1Qe"
7279
+ },
7280
+ {
7281
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
7282
+ name: "Isango",
7283
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7284
+ validUntil: null,
7285
+ externalId: "Gm3Z9eQpHw4L"
7286
+ },
7287
+ {
7288
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7289
+ name: "Isamba",
7290
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7291
+ validUntil: null,
7292
+ externalId: "sT0xVu1KqJ7r"
7293
+ },
7294
+ {
7295
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7296
+ name: "Itambo",
7297
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7298
+ validUntil: null,
7299
+ externalId: "Nq6Bv2HpL9Te"
7300
+ },
7301
+ {
7302
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7303
+ name: "Ezhi",
7304
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7305
+ validUntil: null,
7306
+ externalId: "xK8cQ0ZRy5Wd"
7307
+ },
7308
+ {
7309
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7310
+ name: "Ilanga",
7311
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7312
+ validUntil: null,
7313
+ externalId: "Cq4Jm1XvN8Ls"
7314
+ },
7315
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
7316
+ {
7317
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7318
+ name: "Klow",
7319
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7320
+ validUntil: null,
7321
+ externalId: "IkYcYBUcyY2"
7322
+ },
7323
+ {
7324
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7325
+ name: "Mbondo",
7326
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7327
+ validUntil: null,
7328
+ externalId: "Qhvv5hvo3mY"
7329
+ },
7330
+ {
7331
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7332
+ name: "Ndara",
7333
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7334
+ validUntil: null,
7335
+ externalId: "crXh068O9TR"
7336
+ },
7337
+ {
7338
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7339
+ name: "Olani",
7340
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7341
+ validUntil: null,
7342
+ externalId: "r00It8Tvvp7"
7343
+ },
7344
+ {
7345
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7346
+ name: "Pemba",
7347
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7348
+ validUntil: null,
7349
+ externalId: "ZnUWsbONIaH"
7350
+ },
7351
+ {
7352
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7353
+ name: "Quanza",
7354
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7355
+ validUntil: null,
7356
+ externalId: "fDZycvQTa7l"
7357
+ },
7358
+ {
7359
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7360
+ name: "Rivka",
7361
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7362
+ validUntil: null,
7363
+ externalId: "KqswxCGTELa"
7364
+ },
7365
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
7366
+ {
7367
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7368
+ name: "Mbula",
7369
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7370
+ validUntil: null,
7371
+ externalId: "osEbKjRc9Kg"
7372
+ },
7373
+ {
7374
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7375
+ name: "Ndoki",
7376
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7377
+ validUntil: null,
7378
+ externalId: "aq4daBUAGr3"
7379
+ },
7380
+ {
7381
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7382
+ name: "Tsanga",
7383
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7384
+ validUntil: null,
7385
+ externalId: "cqis6Y8trbJ"
7386
+ },
7387
+ {
7388
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7389
+ name: "Waziri",
7390
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7391
+ validUntil: null,
7392
+ externalId: "LMijHPyyx6d"
7393
+ },
7394
+ {
7395
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7396
+ name: "Zimbi",
7397
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7398
+ validUntil: null,
7399
+ externalId: "pcQYbPuKGZ7"
7400
+ },
7401
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
7402
+ {
7403
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7404
+ name: "Felani",
7405
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7406
+ validUntil: null,
7407
+ externalId: "gSqpoCGdMXp"
7408
+ },
7409
+ {
7410
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7411
+ name: "Goroma",
7412
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7413
+ validUntil: null,
7414
+ externalId: "KvAAIaNqVrp"
7415
+ },
7416
+ {
7417
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7418
+ name: "Halifu",
7419
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7420
+ validUntil: null,
7421
+ externalId: "qe4UnEVt1hv"
7422
+ },
7423
+ {
7424
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7425
+ name: "Jabari",
7426
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7427
+ validUntil: null,
7428
+ externalId: "yHH9Nz4rLOt"
7429
+ },
7430
+ {
7431
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7432
+ name: "Kifani",
7433
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7434
+ validUntil: null,
7435
+ externalId: "eSWmXIGeu1I"
7436
+ },
7437
+ {
7438
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7439
+ name: "Lumela",
7440
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7441
+ validUntil: null,
7442
+ externalId: "bh0b3aI1uP3"
7443
+ }
7444
+ ];
7445
+ var V2_DEFAULT_MOCK_LOCATIONS = [
7446
+ {
7447
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7448
+ name: "Central Provincial Office",
7449
+ locationType: "CRVS_OFFICE",
7450
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7451
+ validUntil: null,
7452
+ externalId: "Xr3Df8WpK6Ys"
7453
+ },
7454
+ {
7455
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7456
+ name: "Central Health Post",
7457
+ locationType: "HEALTH_FACILITY",
7458
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7459
+ validUntil: null
7460
+ },
7461
+ {
7462
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7463
+ name: "Ibombo District Office",
7464
+ locationType: "CRVS_OFFICE",
7465
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7466
+ validUntil: null,
7467
+ externalId: "Sm4Nw7GrD2Vy"
7468
+ },
7469
+ {
7470
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
7471
+ name: "Isamba District Office",
7472
+ locationType: "CRVS_OFFICE",
7473
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7474
+ validUntil: null,
7475
+ externalId: "Vg1Bq5XeH9Lt"
7476
+ },
7477
+ {
7478
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
7479
+ name: "Isango District Office",
7480
+ locationType: "CRVS_OFFICE",
7481
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7482
+ validUntil: null,
7483
+ externalId: "Je7Lm2XqN9Vz"
7484
+ },
7485
+ {
7486
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
7487
+ name: "Sulaka Provincial Office",
7488
+ locationType: "CRVS_OFFICE",
7489
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7490
+ validUntil: null,
7491
+ externalId: "Ht2Wp9KcX5Qv"
7492
+ },
7493
+ {
7494
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
7495
+ name: "Ilanga District Office",
7496
+ locationType: "CRVS_OFFICE",
7497
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7498
+ validUntil: null,
7499
+ externalId: "Yp6Ds1WqN3Xz"
7500
+ },
7501
+ {
7502
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
7503
+ name: "Chamakubi Health Post",
7504
+ locationType: "HEALTH_FACILITY",
7505
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7506
+ validUntil: null,
7507
+ externalId: "M1nFr8LbC2Qy"
7508
+ },
7509
+ {
7510
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
7511
+ name: "Ibombo Rural Health Centre",
7512
+ locationType: "HEALTH_FACILITY",
7513
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7514
+ validUntil: null,
7515
+ externalId: "bT7pV6YrW0Xc"
7516
+ },
7517
+ {
7518
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
7519
+ name: "Chikobo Rural Health Centre",
7520
+ locationType: "HEALTH_FACILITY",
7521
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7522
+ validUntil: null,
7523
+ externalId: "zE4qPn2SgJ5d"
7524
+ },
7525
+ {
7526
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
7527
+ name: "Chilochabalenje Health Post",
7528
+ locationType: "HEALTH_FACILITY",
7529
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7530
+ validUntil: null,
7531
+ externalId: "H8vDs1MqR4Uf"
7532
+ },
7533
+ {
7534
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
7535
+ name: "Chipeso Rural Health Centre",
7536
+ locationType: "HEALTH_FACILITY",
7537
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7538
+ validUntil: null,
7539
+ externalId: "Qw3uZ9KfX6Lm"
7540
+ },
7541
+ {
7542
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
7543
+ name: "Chisamba Rural Health Centre",
7544
+ locationType: "HEALTH_FACILITY",
7545
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7546
+ validUntil: null,
7547
+ externalId: "Yr0pCg8LdM2s"
7548
+ },
7549
+ {
7550
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
7551
+ name: "Chitanda Rural Health Centre",
7552
+ locationType: "HEALTH_FACILITY",
7553
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7554
+ validUntil: null,
7555
+ externalId: "tS9gJ4PwB1Qx"
7556
+ },
7557
+ {
7558
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
7559
+ name: "Golden Valley Rural Health Centre",
7560
+ locationType: "HEALTH_FACILITY",
7561
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7562
+ validUntil: null,
7563
+ externalId: "Ld7Qm3XsA8Vr"
7564
+ },
7565
+ {
7566
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
7567
+ name: "Ipongo Rural Health Centre",
7568
+ locationType: "HEALTH_FACILITY",
7569
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7570
+ validUntil: null,
7571
+ externalId: "kF2sW9DmH0Bt"
7572
+ },
7573
+ {
7574
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
7575
+ name: "Itumbwe Health Post",
7576
+ locationType: "HEALTH_FACILITY",
7577
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7578
+ validUntil: null,
7579
+ externalId: "Ue5Xb3VaC7Pq"
7580
+ },
7581
+ {
7582
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
7583
+ name: "Kabangalala Rural Health Centre",
7584
+ locationType: "HEALTH_FACILITY",
7585
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7586
+ validUntil: null,
7587
+ externalId: "Pz8Kc1TqH6Jn"
7588
+ },
7589
+ // Village offices
7590
+ {
7591
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
7592
+ name: "Klow Village Office",
7593
+ locationType: "CRVS_OFFICE",
7594
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7595
+ validUntil: null,
7596
+ externalId: "PmAyxAJkxiJ"
7597
+ }
7598
+ ];
7599
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7600
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7601
+ );
7602
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7603
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7604
+ );
7605
+
6958
7606
  // ../commons/src/notification/UserNotifications.ts
6959
7607
  var z44 = __toESM(require("zod/v4"));
6960
7608
  var TriggerEvent = {