@opencrvs/toolkit 2.0.0-rc.fef9d21 → 2.0.0-rc.ff1424b

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 (62) 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 +312 -130
  4. package/dist/cli.js +548 -178
  5. package/dist/commons/api/router.d.ts +3390 -241
  6. package/dist/commons/application-config/index.d.ts +17 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +360 -10
  8. package/dist/commons/conditionals/validate.d.ts +52 -2
  9. package/dist/commons/events/ActionConfig.d.ts +28 -2
  10. package/dist/commons/events/ActionDocument.d.ts +6 -0
  11. package/dist/commons/events/ActionInput.d.ts +114 -0
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  13. package/dist/commons/events/Draft.d.ts +4 -2
  14. package/dist/commons/events/EventDocument.d.ts +3 -0
  15. package/dist/commons/events/EventIndex.d.ts +0 -3
  16. package/dist/commons/events/EventMetadata.d.ts +0 -7
  17. package/dist/commons/events/FieldConfig.d.ts +388 -50
  18. package/dist/commons/events/FieldType.d.ts +1 -0
  19. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  20. package/dist/commons/events/FieldValue.d.ts +6 -0
  21. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  22. package/dist/commons/events/field.d.ts +53 -1
  23. package/dist/commons/events/index.d.ts +2 -0
  24. package/dist/commons/events/locations.d.ts +38 -1
  25. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  26. package/dist/commons/events/scopes.d.ts +24 -1
  27. package/dist/commons/events/state/flags.d.ts +16 -0
  28. package/dist/commons/events/state/index.d.ts +0 -4
  29. package/dist/commons/events/state/utils.d.ts +12 -289
  30. package/dist/commons/events/utils.d.ts +13 -2
  31. package/dist/conditionals/index.js +92 -9
  32. package/dist/events/index.js +1204 -290
  33. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  34. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  35. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  36. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  37. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  38. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  39. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  40. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  41. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  42. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  43. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  44. package/dist/migrations/v2.0/index.d.ts +5 -3
  45. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  46. package/dist/migrations/v2.0/index.js +546 -176
  47. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  48. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  49. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  50. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  51. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  52. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  53. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  54. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  55. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  56. package/dist/notification/index.js +936 -162
  57. package/dist/scopes/index.d.ts +91 -16
  58. package/dist/scopes/index.js +55 -12
  59. package/opencrvs-toolkit-2.0.0-rc.ff1424b.tgz +0 -0
  60. package/package.json +6 -2
  61. package/tsconfig.tsbuildinfo +1 -1
  62. package/opencrvs-toolkit-2.0.0-rc.fef9d21.tgz +0 -0
@@ -110,6 +110,10 @@ var scopeByEvent = z2.preprocess(
110
110
  (val) => val === void 0 ? void 0 : [val].flat(),
111
111
  z2.array(z2.string()).optional()
112
112
  ).describe("Event type, e.g. birth, death");
113
+ var userRole = z2.preprocess(
114
+ (val) => val === void 0 ? void 0 : [val].flat(),
115
+ z2.array(z2.string()).optional()
116
+ ).describe("User role, e.g. admin, field agent");
113
117
  var scopeOptionsPlaceEvent = z2.object({
114
118
  event: scopeByEvent,
115
119
  placeOfEvent: JurisdictionFilter.optional()
@@ -133,6 +137,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
133
137
  var AccessLevelOptions = z2.object({
134
138
  accessLevel: JurisdictionFilter.optional()
135
139
  });
140
+ var AllUserScopeOptions = AccessLevelOptions.extend({
141
+ role: userRole.optional()
142
+ });
136
143
  var WorkqueueOrDashboardOptions = z2.object({
137
144
  ids: z2.preprocess(
138
145
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -142,6 +149,7 @@ var WorkqueueOrDashboardOptions = z2.object({
142
149
  var AllScopeOptions = z2.object({
143
150
  ...AllRecordScopeOptions.shape,
144
151
  ...AccessLevelOptions.shape,
152
+ ...AllUserScopeOptions.shape,
145
153
  ...WorkqueueOrDashboardOptions.shape
146
154
  });
147
155
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -214,6 +222,30 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
214
222
  ]).describe(
215
223
  "Scopes used to check user's permission to perform actions on a record."
216
224
  );
225
+ var SystemScopeType = z2.enum([
226
+ "organisation.read-locations",
227
+ "user.read",
228
+ "user.create",
229
+ "user.edit",
230
+ "user.search"
231
+ ]);
232
+ var UserScopeType = SystemScopeType.extract([
233
+ "user.read",
234
+ "user.create",
235
+ "user.edit",
236
+ "user.search"
237
+ ]);
238
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
239
+ var UserScopeV2 = z2.discriminatedUnion("type", [
240
+ z2.object({
241
+ type: ScopesWithRoleOption,
242
+ options: AllUserScopeOptions.optional()
243
+ }),
244
+ z2.object({
245
+ type: UserScopeType.extract(["user.read", "user.search"]),
246
+ options: AccessLevelOptions.optional()
247
+ })
248
+ ]);
217
249
  var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
218
250
  z2.object({
219
251
  type: ScopesWithPlaceEventOptions,
@@ -234,16 +266,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
234
266
  }).optional()
235
267
  })
236
268
  ]).describe("Resolved scope with location/user IDs instead of filters.");
237
- var SystemScopeType = z2.enum([
238
- "organisation.read-locations",
239
- "user.read",
240
- "user.create",
241
- "user.edit"
242
- ]);
243
269
  var Scope = z2.discriminatedUnion("type", [
244
270
  z2.object({ type: PlainScopeType }),
245
271
  ...RecordScopeV2.options,
246
- z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
272
+ ...UserScopeV2.options,
273
+ z2.object({
274
+ type: z2.literal("organisation.read-locations"),
275
+ options: AccessLevelOptions.optional()
276
+ }),
247
277
  z2.object({
248
278
  type: z2.literal("workqueue"),
249
279
  options: WorkqueueOrDashboardOptions
@@ -263,7 +293,9 @@ var ScopeType = z2.enum([
263
293
  var EncodedScope = z2.string().brand("EncodedScope");
264
294
  var DEFAULT_SCOPE_OPTIONS = {
265
295
  placeOfEvent: JurisdictionFilter.enum.all,
266
- accessLevel: JurisdictionFilter.enum.all
296
+ accessLevel: JurisdictionFilter.enum.all,
297
+ registeredIn: JurisdictionFilter.enum.all,
298
+ declaredIn: JurisdictionFilter.enum.all
267
299
  };
268
300
 
269
301
  // ../commons/src/authentication.ts
@@ -622,7 +654,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
622
654
  ShowConditional,
623
655
  // Action can be shown to the user in the list but as disabled
624
656
  EnableConditional
625
- ]);
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
+ });
626
661
  var DisplayOnReviewConditional = z7.object({
627
662
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
628
663
  conditional: Conditional
@@ -637,8 +672,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
637
672
  // Field output can be shown / hidden on the review page
638
673
  DisplayOnReviewConditional
639
674
  ]).meta({
640
- description: "Field conditional configuration",
641
- 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."
642
677
  });
643
678
 
644
679
  // ../commons/src/events/FieldType.ts
@@ -735,6 +770,11 @@ var FieldTypesToHideInReview = [
735
770
  FieldType.ALPHA_PRINT_BUTTON,
736
771
  FieldType.ALPHA_HIDDEN
737
772
  ];
773
+ var HiddenFieldTypes = [
774
+ FieldType.HTTP,
775
+ FieldType.QUERY_PARAM_READER,
776
+ FieldType.ALPHA_HIDDEN
777
+ ];
738
778
 
739
779
  // ../commons/src/events/FieldValue.ts
740
780
  var z12 = __toESM(require("zod/v4"));
@@ -853,7 +893,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
853
893
  // ../commons/src/events/FieldValue.ts
854
894
  var TextValue = z12.string();
855
895
  var HiddenFieldValue = z12.string();
856
- var NonEmptyTextValue = TextValue.min(1);
896
+ var NonEmptyTextValue = z12.string().trim().min(1);
857
897
  var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
858
898
  var AgeValue = z12.object({
859
899
  age: z12.number(),
@@ -882,6 +922,7 @@ var DateRangeFieldValue = z12.object({
882
922
  var EmailValue = z12.email();
883
923
  var CheckboxFieldValue = z12.boolean();
884
924
  var NumberFieldValue = z12.number();
925
+ var SignatureFieldValue = FileFieldValue;
885
926
  var ButtonFieldValue = z12.number();
886
927
  var VerificationStatusValue = z12.enum([
887
928
  "verified",
@@ -950,28 +991,20 @@ function schemaPriority(schema) {
950
991
  return idx === -1 ? 9999 : idx;
951
992
  }
952
993
  function safeUnion(schemas) {
994
+ const sortedSchemas = [...schemas].sort(
995
+ (a, b) => schemaPriority(a) - schemaPriority(b)
996
+ );
953
997
  return z12.any().superRefine((val, ctx) => {
954
- const successful = schemas.filter((s) => s.safeParse(val).success);
955
- if (successful.length === 1) {
956
- return;
957
- }
958
- if (successful.length === 0) {
959
- ctx.addIssue({
960
- code: "invalid_type",
961
- expected: "custom",
962
- message: "Value does not match any schema"
963
- });
964
- return;
965
- }
966
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
967
- const best = successful[0];
968
- if (!best.safeParse(val).success) {
969
- ctx.addIssue({
970
- expected: "custom",
971
- code: "invalid_type",
972
- message: "Value did not match the best schema"
973
- });
998
+ for (const schema of sortedSchemas) {
999
+ if (schema.safeParse(val).success) {
1000
+ return;
1001
+ }
974
1002
  }
1003
+ ctx.addIssue({
1004
+ code: "invalid_type",
1005
+ expected: "custom",
1006
+ message: "Value does not match any schema"
1007
+ });
975
1008
  }).meta({
976
1009
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
977
1010
  });
@@ -1188,8 +1221,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1188
1221
  var ApprovedCorrectionAction = ActionBase.extend(
1189
1222
  z14.object({
1190
1223
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1191
- requestId: z14.string()
1224
+ requestId: z14.string(),
1192
1225
  // TODO move into 'content' property
1226
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1193
1227
  }).shape
1194
1228
  );
1195
1229
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1281,6 +1315,9 @@ var FlagConfig = z15.object({
1281
1315
  "Indicates if this flag expects an action to be performed to be cleared."
1282
1316
  ),
1283
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."
1284
1321
  });
1285
1322
  var ActionFlagConfig = z15.object({
1286
1323
  id: Flag,
@@ -1288,6 +1325,9 @@ var ActionFlagConfig = z15.object({
1288
1325
  conditional: Conditional.optional().describe(
1289
1326
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1290
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."
1291
1331
  });
1292
1332
 
1293
1333
  // ../commons/src/events/EventMetadata.ts
@@ -1309,8 +1349,7 @@ var ActionCreationMetadata = z16.object({
1309
1349
  ),
1310
1350
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1311
1351
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1312
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1313
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1352
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1314
1353
  });
1315
1354
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1316
1355
  registrationNumber: z16.string().describe(
@@ -1338,9 +1377,6 @@ var EventMetadata = z16.object({
1338
1377
  createdAtLocation: UUID.nullish().describe(
1339
1378
  "Location of the user who created the event."
1340
1379
  ),
1341
- createdBySignature: DocumentPath.nullish().describe(
1342
- "Signature of the user who created the event."
1343
- ),
1344
1380
  updatedAtLocation: UUID.nullish().describe(
1345
1381
  "Location of the user who last changed the status."
1346
1382
  ),
@@ -1633,14 +1669,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1633
1669
  }
1634
1670
  }).describe("Unique identifier for the field");
1635
1671
  var FieldReference = import_v43.default.object({
1636
- $$field: FieldId,
1672
+ $$field: FieldId.describe("Id of the field to reference"),
1637
1673
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1638
1674
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1675
+ ),
1676
+ $$code: import_v43.default.string().optional().describe(
1677
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1678
+ )
1679
+ }).describe(
1680
+ "Reference to a field value, with an optional client-side computation applied."
1681
+ );
1682
+ var ComputedDefaultValue = import_v43.default.object({
1683
+ $$code: import_v43.default.string().describe(
1684
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1639
1685
  )
1640
- }).describe("Reference to a field by its ID");
1686
+ }).describe("A context-only computation used as a field default value.");
1641
1687
  var ValidationConfig = import_v43.default.object({
1642
- validator: Conditional,
1643
- message: TranslationConfig
1688
+ validator: Conditional.describe(
1689
+ "Conditional expression that must hold for the field value to be considered valid."
1690
+ ),
1691
+ message: TranslationConfig.describe(
1692
+ "Error message displayed when the validator does not hold."
1693
+ )
1694
+ }).meta({
1695
+ id: "ValidationConfig",
1696
+ 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."
1644
1697
  });
1645
1698
  var requiredSchema = import_v43.default.union([
1646
1699
  import_v43.default.boolean(),
@@ -1671,7 +1724,7 @@ var BaseField = import_v43.default.object({
1671
1724
  "Indicates whether the field can be modified during record correction."
1672
1725
  ),
1673
1726
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1674
- "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."
1727
+ "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."
1675
1728
  ),
1676
1729
  analytics: import_v43.default.boolean().default(false).optional().describe(
1677
1730
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1679,30 +1732,40 @@ var BaseField = import_v43.default.object({
1679
1732
  }).describe("Common properties shared across all field types.");
1680
1733
  var Divider = BaseField.extend({
1681
1734
  type: import_v43.default.literal(FieldType.DIVIDER)
1735
+ }).meta({
1736
+ description: "A horizontal line divider",
1737
+ id: "Divider"
1682
1738
  });
1683
1739
  var TextField = BaseField.extend({
1684
1740
  type: import_v43.default.literal(FieldType.TEXT),
1685
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1741
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1686
1742
  configuration: import_v43.default.object({
1687
1743
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1688
1744
  type: import_v43.default.enum(["text", "password"]).optional(),
1689
1745
  prefix: TranslationConfig.optional(),
1690
1746
  postfix: TranslationConfig.optional()
1691
1747
  }).default({ type: "text" }).optional()
1692
- }).describe("Text input");
1748
+ }).meta({
1749
+ description: "A text input field",
1750
+ id: "TextField"
1751
+ });
1693
1752
  var NumberField = BaseField.extend({
1694
1753
  type: import_v43.default.literal(FieldType.NUMBER),
1695
- defaultValue: NumberFieldValue.optional(),
1754
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1696
1755
  configuration: import_v43.default.object({
1697
1756
  min: import_v43.default.number().optional().describe("Minimum value"),
1698
1757
  max: import_v43.default.number().optional().describe("Maximum value"),
1758
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1699
1759
  prefix: TranslationConfig.optional(),
1700
1760
  postfix: TranslationConfig.optional()
1701
1761
  }).optional()
1702
- }).describe("Number input");
1762
+ }).meta({
1763
+ description: "A number input field",
1764
+ id: "NumberField"
1765
+ });
1703
1766
  var TextAreaField = BaseField.extend({
1704
1767
  type: import_v43.default.literal(FieldType.TEXTAREA),
1705
- defaultValue: NonEmptyTextValue.optional(),
1768
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1706
1769
  configuration: import_v43.default.object({
1707
1770
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1708
1771
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1710,7 +1773,10 @@ var TextAreaField = BaseField.extend({
1710
1773
  prefix: TranslationConfig.optional(),
1711
1774
  postfix: TranslationConfig.optional()
1712
1775
  }).default({ rows: 4 }).optional()
1713
- }).describe("Multiline text input");
1776
+ }).meta({
1777
+ description: "A multiline text input",
1778
+ id: "TextAreaField"
1779
+ });
1714
1780
  var ImageMimeType = import_v43.default.enum([
1715
1781
  "image/png",
1716
1782
  "image/jpg",
@@ -1733,58 +1799,76 @@ var SignatureField = BaseField.extend({
1733
1799
  signaturePromptLabel: TranslationConfig.describe(
1734
1800
  "Title of the signature modal"
1735
1801
  ),
1736
- defaultValue: FieldValue.optional(),
1802
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1737
1803
  configuration: import_v43.default.object({
1738
1804
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1739
1805
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1740
1806
  }).default({
1741
1807
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1742
1808
  })
1743
- }).describe("Signature input field");
1809
+ }).meta({
1810
+ description: "A signature input field",
1811
+ id: "SignatureField"
1812
+ });
1744
1813
  var EmailField = BaseField.extend({
1745
1814
  type: import_v43.default.literal(FieldType.EMAIL),
1746
1815
  configuration: import_v43.default.object({
1747
1816
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1748
1817
  }).default({ maxLength: 255 }).optional(),
1749
- defaultValue: NonEmptyTextValue.optional()
1818
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1819
+ }).meta({
1820
+ description: "An email input field",
1821
+ id: "EmailField"
1750
1822
  });
1751
1823
  var DateField = BaseField.extend({
1752
1824
  type: import_v43.default.literal(FieldType.DATE),
1753
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1825
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1754
1826
  configuration: import_v43.default.object({
1755
1827
  notice: TranslationConfig.describe(
1756
1828
  "Text to display above the date input"
1757
1829
  ).optional()
1758
1830
  }).optional()
1759
- }).describe("A single date input (yyyy-MM-dd)");
1831
+ }).meta({
1832
+ description: "A date input (yyyy-MM-dd)",
1833
+ id: "DateField"
1834
+ });
1760
1835
  var AgeField = BaseField.extend({
1761
1836
  type: import_v43.default.literal(FieldType.AGE),
1762
- defaultValue: NumberFieldValue.optional(),
1837
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1763
1838
  configuration: import_v43.default.object({
1764
1839
  asOfDate: FieldReference,
1765
1840
  prefix: TranslationConfig.optional(),
1766
1841
  postfix: TranslationConfig.optional()
1767
1842
  })
1768
- }).describe("An age input field which uses the current date as the asOfDate");
1843
+ }).meta({
1844
+ description: "An age input field which uses the current date as the asOfDate",
1845
+ id: "AgeField"
1846
+ });
1769
1847
  var TimeField = BaseField.extend({
1770
1848
  type: import_v43.default.literal(FieldType.TIME),
1771
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1849
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1772
1850
  configuration: import_v43.default.object({
1773
1851
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1774
1852
  notice: TranslationConfig.describe(
1775
1853
  "Text to display above the time input"
1776
1854
  ).optional()
1777
1855
  }).optional()
1778
- }).describe("A single date input (HH-mm)");
1856
+ }).meta({
1857
+ description: "A single time input (HH-mm)",
1858
+ id: "TimeField"
1859
+ });
1779
1860
  var DateRangeField = BaseField.extend({
1780
1861
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1781
- defaultValue: DateRangeFieldValue.optional(),
1862
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1782
1863
  configuration: import_v43.default.object({
1783
1864
  notice: TranslationConfig.describe(
1784
1865
  "Text to display above the date input"
1785
1866
  ).optional()
1786
1867
  }).optional()
1787
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1868
+ }).meta({
1869
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1870
+ id: "DateRangeField"
1871
+ });
1788
1872
  var HtmlFontVariant = import_v43.default.enum([
1789
1873
  "reg12",
1790
1874
  "reg14",
@@ -1828,21 +1912,33 @@ var ImageViewField = BaseField.extend({
1828
1912
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1829
1913
  defaultValue: NonEmptyTextValue.optional(),
1830
1914
  configuration: ImageConfiguration
1831
- }).describe("A read-only image component for form pages");
1915
+ }).meta({
1916
+ description: "A read-only image component for form pages",
1917
+ id: "ImageViewField"
1918
+ });
1832
1919
  var Paragraph = BaseField.extend({
1833
1920
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1834
1921
  configuration: ParagraphConfiguration
1835
- }).describe("A read-only HTML <p> paragraph");
1922
+ }).meta({
1923
+ description: "A read-only HTML <p> paragraph",
1924
+ id: "Paragraph"
1925
+ });
1836
1926
  var Heading = BaseField.extend({
1837
1927
  type: import_v43.default.literal(FieldType.HEADING),
1838
1928
  configuration: HeadingConfiguration
1839
- }).describe("A read-only heading component for form pages");
1929
+ }).meta({
1930
+ description: "A read-only heading component for form pages",
1931
+ id: "Heading"
1932
+ });
1840
1933
  var PageHeader = BaseField.extend({
1841
1934
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1842
- }).describe("A read-only header component for form pages");
1935
+ }).meta({
1936
+ description: "A read-only header component for form pages",
1937
+ id: "PageHeader"
1938
+ });
1843
1939
  var File = BaseField.extend({
1844
1940
  type: import_v43.default.literal(FieldType.FILE),
1845
- defaultValue: FileFieldValue.optional(),
1941
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1846
1942
  configuration: import_v43.default.object({
1847
1943
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1848
1944
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1858,7 +1954,10 @@ var File = BaseField.extend({
1858
1954
  }).default({
1859
1955
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1860
1956
  })
1861
- }).describe("File upload");
1957
+ }).meta({
1958
+ description: "A file upload field",
1959
+ id: "File"
1960
+ });
1862
1961
  var SelectOption = import_v43.default.object({
1863
1962
  value: import_v43.default.string().describe("The value of the option"),
1864
1963
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1866,7 +1965,7 @@ var SelectOption = import_v43.default.object({
1866
1965
  });
1867
1966
  var NumberWithUnitField = BaseField.extend({
1868
1967
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1869
- defaultValue: NumberWithUnitFieldValue.optional(),
1968
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1870
1969
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1871
1970
  configuration: import_v43.default.object({
1872
1971
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1875,17 +1974,23 @@ var NumberWithUnitField = BaseField.extend({
1875
1974
  "Placeholder for the number field"
1876
1975
  )
1877
1976
  }).optional()
1878
- }).describe("Number with unit input");
1977
+ }).meta({
1978
+ description: "A number with unit input field",
1979
+ id: "NumberWithUnitField"
1980
+ });
1879
1981
  var RadioGroup = BaseField.extend({
1880
1982
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1881
- defaultValue: TextValue.optional(),
1983
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1882
1984
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1883
1985
  configuration: import_v43.default.object({
1884
1986
  styles: import_v43.default.object({
1885
1987
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1886
1988
  }).optional()
1887
1989
  }).optional()
1888
- }).describe("Grouped radio options");
1990
+ }).meta({
1991
+ description: "A grouped radio button field",
1992
+ id: "RadioGroup"
1993
+ });
1889
1994
  var BulletList = BaseField.extend({
1890
1995
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1891
1996
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1894,10 +1999,13 @@ var BulletList = BaseField.extend({
1894
1999
  fontVariant: HtmlFontVariant.optional()
1895
2000
  }).optional()
1896
2001
  }).default({})
1897
- }).describe("A list of bullet points");
2002
+ }).meta({
2003
+ description: "A list of bullet points",
2004
+ id: "BulletList"
2005
+ });
1898
2006
  var Select = BaseField.extend({
1899
2007
  type: import_v43.default.literal(FieldType.SELECT),
1900
- defaultValue: TextValue.optional(),
2008
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1901
2009
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1902
2010
  noOptionsMessage: TranslationConfig.optional().describe(
1903
2011
  `
@@ -1909,16 +2017,22 @@ var Select = BaseField.extend({
1909
2017
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1910
2018
  `
1911
2019
  )
1912
- }).describe("Select input");
2020
+ }).meta({
2021
+ description: "A select input field",
2022
+ id: "Select"
2023
+ });
1913
2024
  var SelectDateRangeOption = import_v43.default.object({
1914
2025
  value: SelectDateRangeValue.describe("The value of the option"),
1915
2026
  label: TranslationConfig.describe("The label of the option")
1916
2027
  });
1917
2028
  var SelectDateRangeField = BaseField.extend({
1918
2029
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1919
- defaultValue: SelectDateRangeValue.optional(),
2030
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1920
2031
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1921
- }).describe("Select input with date range options");
2032
+ }).meta({
2033
+ description: "A date range selection field",
2034
+ id: "SelectDateRangeField"
2035
+ });
1922
2036
  var NameConfig = import_v43.default.object({
1923
2037
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1924
2038
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1930,7 +2044,7 @@ var NameField = BaseField.extend({
1930
2044
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1931
2045
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1932
2046
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1933
- }).optional(),
2047
+ }).or(ComputedDefaultValue).optional(),
1934
2048
  configuration: import_v43.default.object({
1935
2049
  name: NameConfig.default({
1936
2050
  firstname: { required: true },
@@ -1949,26 +2063,41 @@ var NameField = BaseField.extend({
1949
2063
  surname: { required: true }
1950
2064
  }
1951
2065
  }).optional()
1952
- }).describe("Name input field");
2066
+ }).meta({
2067
+ description: "A field for entering a persons name",
2068
+ id: "NameField"
2069
+ });
1953
2070
  var PhoneField = BaseField.extend({
1954
- defaultValue: NonEmptyTextValue.optional(),
2071
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1955
2072
  type: import_v43.default.literal(FieldType.PHONE)
1956
- }).describe("Phone input field");
2073
+ }).meta({
2074
+ description: "A field for entering a phone number",
2075
+ id: "PhoneField"
2076
+ });
1957
2077
  var IdField = BaseField.extend({
1958
- defaultValue: NonEmptyTextValue.optional(),
2078
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1959
2079
  type: import_v43.default.literal(FieldType.ID)
1960
- }).describe("ID input field");
2080
+ }).meta({
2081
+ description: "A field for entering an ID",
2082
+ id: "IdField"
2083
+ });
1961
2084
  var Checkbox = BaseField.extend({
1962
2085
  type: import_v43.default.literal(FieldType.CHECKBOX),
1963
- defaultValue: CheckboxFieldValue.default(false)
1964
- }).describe("Boolean checkbox field");
2086
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
2087
+ }).meta({
2088
+ description: "A boolean checkbox field",
2089
+ id: "Checkbox"
2090
+ });
1965
2091
  var Country = BaseField.extend({
1966
2092
  type: import_v43.default.literal(FieldType.COUNTRY),
1967
- defaultValue: NonEmptyTextValue.optional(),
2093
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1968
2094
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1969
2095
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1970
2096
  )
1971
- }).describe("Country select field");
2097
+ }).meta({
2098
+ description: "A field for selecting a country",
2099
+ id: "Country"
2100
+ });
1972
2101
  var AllowedLocations = JurisdictionReference.optional().describe(
1973
2102
  "Limits which location options are selectable depending on user jurisdiction and location."
1974
2103
  );
@@ -1977,28 +2106,33 @@ var AdministrativeAreas = import_v43.default.enum([
1977
2106
  "HEALTH_FACILITY",
1978
2107
  "CRVS_OFFICE"
1979
2108
  ]);
1980
- var AdministrativeAreaConfiguration = import_v43.default.object({
1981
- partOf: FieldReference.optional().describe("Parent location"),
1982
- type: AdministrativeAreas,
1983
- allowedLocations: AllowedLocations
1984
- }).describe("Administrative area options");
1985
2109
  var AdministrativeAreaField = BaseField.extend({
1986
2110
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1987
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1988
- configuration: AdministrativeAreaConfiguration
1989
- }).describe("Administrative area input field e.g. facility, office");
2111
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2112
+ configuration: import_v43.default.object({
2113
+ partOf: FieldReference.optional().describe("Parent location"),
2114
+ type: AdministrativeAreas,
2115
+ allowedLocations: AllowedLocations
2116
+ }).describe("Administrative area options")
2117
+ }).meta({
2118
+ description: "Administrative area input field",
2119
+ id: "AdministrativeAreaField"
2120
+ });
1990
2121
  var LocationInput = BaseField.extend({
1991
2122
  type: import_v43.default.literal(FieldType.LOCATION),
1992
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2123
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1993
2124
  configuration: import_v43.default.object({
1994
2125
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1995
2126
  allowedLocations: AllowedLocations
1996
2127
  }).optional()
1997
- }).describe("Input field for a location");
2128
+ }).meta({
2129
+ description: "A field for selecting a location",
2130
+ id: "LocationInput"
2131
+ });
1998
2132
  var FileUploadWithOptions = BaseField.extend({
1999
2133
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2000
2134
  options: import_v43.default.array(SelectOption).describe("A list of options"),
2001
- defaultValue: FileFieldWithOptionValue.optional(),
2135
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
2002
2136
  configuration: import_v43.default.object({
2003
2137
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2004
2138
  maxImageSize: import_v43.default.object({
@@ -2008,15 +2142,18 @@ var FileUploadWithOptions = BaseField.extend({
2008
2142
  }).default({
2009
2143
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2010
2144
  })
2145
+ }).meta({
2146
+ description: "A field for uploading files with file type options",
2147
+ id: "FileUploadWithOptions"
2011
2148
  });
2012
2149
  var Facility = BaseField.extend({
2013
2150
  type: import_v43.default.literal(FieldType.FACILITY),
2014
- defaultValue: NonEmptyTextValue.optional(),
2151
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2015
2152
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2016
2153
  }).describe("Input field for a facility");
2017
2154
  var Office = BaseField.extend({
2018
2155
  type: import_v43.default.literal(FieldType.OFFICE),
2019
- defaultValue: NonEmptyTextValue.optional(),
2156
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2020
2157
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2021
2158
  }).describe("Input field for an office");
2022
2159
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2052,8 +2189,11 @@ var Address = BaseField.extend({
2052
2189
  ).optional(),
2053
2190
  allowedLocations: AllowedLocations
2054
2191
  }).optional(),
2055
- defaultValue: DefaultAddressFieldValue.optional()
2056
- }).describe("Address input field \u2013 a combination of location and text fields");
2192
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2193
+ }).meta({
2194
+ description: "Address input field \u2013 a combination of location and text fields",
2195
+ id: "Address"
2196
+ });
2057
2197
  var StaticDataEntry = import_v43.default.object({
2058
2198
  id: import_v43.default.string().describe("ID for the data entry."),
2059
2199
  label: TranslationConfig,
@@ -2068,7 +2208,10 @@ var DataField = BaseField.extend({
2068
2208
  subtitle: TranslationConfig.optional(),
2069
2209
  data: import_v43.default.array(DataEntry)
2070
2210
  })
2071
- }).describe("Data field for displaying read-only data");
2211
+ }).meta({
2212
+ description: "A field for displaying a table of read-only data",
2213
+ id: "DataField"
2214
+ });
2072
2215
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2073
2216
  var ButtonType = import_v43.default.enum([
2074
2217
  "primary",
@@ -2093,13 +2236,19 @@ var ButtonConfiguration = import_v43.default.object({
2093
2236
  });
2094
2237
  var ButtonField = BaseField.extend({
2095
2238
  type: import_v43.default.literal(FieldType.BUTTON),
2096
- defaultValue: ButtonFieldValue.optional(),
2239
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
2097
2240
  configuration: ButtonConfiguration
2098
- }).describe("Generic button without any built-in functionality");
2241
+ }).meta({
2242
+ description: "A generic button that can be used to trigger an action",
2243
+ id: "ButtonField"
2244
+ });
2099
2245
  var FieldGroup = BaseField.extend({
2100
2246
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2101
2247
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2102
2248
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2249
+ }).meta({
2250
+ description: "A group of fields that are displayed together",
2251
+ id: "FieldGroup"
2103
2252
  });
2104
2253
  var AlphaPrintButton = BaseField.extend({
2105
2254
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2109,10 +2258,13 @@ var AlphaPrintButton = BaseField.extend({
2109
2258
  "Label for the print button"
2110
2259
  )
2111
2260
  })
2112
- }).describe("Print button field for printing certificates");
2261
+ }).meta({
2262
+ description: "An experimental print button field for printing certificates during the declaration process",
2263
+ id: "AlphaPrintButton"
2264
+ });
2113
2265
  var HttpField = BaseField.extend({
2114
2266
  type: import_v43.default.literal(FieldType.HTTP),
2115
- defaultValue: HttpFieldValue.optional(),
2267
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
2116
2268
  configuration: import_v43.default.object({
2117
2269
  trigger: FieldReference.optional().describe(
2118
2270
  "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."
@@ -2125,20 +2277,30 @@ var HttpField = BaseField.extend({
2125
2277
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2126
2278
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2127
2279
  })
2128
- }).describe("HTTP request function triggered by a button click or other event");
2280
+ }).meta({
2281
+ 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.",
2282
+ id: "HttpField"
2283
+ });
2129
2284
  var AutocompleteField = BaseField.extend({
2130
2285
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2131
2286
  configuration: import_v43.default.object({
2132
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2287
+ url: import_v43.default.string().describe(
2288
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2289
+ ).optional(),
2133
2290
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2134
2291
  defaultOptions: import_v43.default.array(
2135
2292
  import_v43.default.object({
2136
2293
  label: import_v43.default.string(),
2137
2294
  value: import_v43.default.string()
2138
2295
  })
2139
- ).optional()
2296
+ ).optional().describe(
2297
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2298
+ )
2140
2299
  })
2141
- }).describe("Autocomplete input field");
2300
+ }).meta({
2301
+ 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.",
2302
+ id: "AutocompleteField"
2303
+ });
2142
2304
  var SearchField = HttpField.extend({
2143
2305
  type: import_v43.default.literal(FieldType.SEARCH),
2144
2306
  configuration: SearchQuery.pick({
@@ -2171,6 +2333,9 @@ var SearchField = HttpField.extend({
2171
2333
  ok: TranslationConfig.optional()
2172
2334
  }).optional()
2173
2335
  })
2336
+ }).meta({
2337
+ description: "A search input field",
2338
+ id: "SearchField"
2174
2339
  });
2175
2340
  var LinkButtonField = BaseField.extend({
2176
2341
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2179,28 +2344,35 @@ var LinkButtonField = BaseField.extend({
2179
2344
  text: TranslationConfig.describe("Text to display on the button"),
2180
2345
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2181
2346
  })
2182
- }).describe("Button that opens a link");
2347
+ }).meta({
2348
+ description: "A button that opens a URL link",
2349
+ id: "LinkButtonField"
2350
+ });
2183
2351
  var VerificationStatus = BaseField.extend({
2184
2352
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2185
- defaultValue: VerificationStatusValue.optional(),
2353
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
2186
2354
  configuration: import_v43.default.object({
2187
2355
  status: TranslationConfig.describe("Text to display on the status pill."),
2188
2356
  description: TranslationConfig.describe(
2189
2357
  "Explaining text on the banner in form."
2190
2358
  )
2191
2359
  })
2360
+ }).meta({
2361
+ 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.",
2362
+ id: "VerificationStatus"
2192
2363
  });
2193
2364
  var QueryParamReaderField = BaseField.extend({
2194
2365
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2195
2366
  configuration: import_v43.default.object({
2196
2367
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2197
2368
  })
2198
- }).describe(
2199
- "A field that maps URL query params into form values and clears them afterward"
2200
- );
2369
+ }).meta({
2370
+ description: "A field that maps URL query params into form values and clears them afterward",
2371
+ id: "QueryParamReaderField"
2372
+ });
2201
2373
  var QrReaderField = BaseField.extend({
2202
2374
  type: import_v43.default.literal(FieldType.QR_READER),
2203
- defaultValue: QrReaderFieldValue.optional(),
2375
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
2204
2376
  configuration: import_v43.default.object({
2205
2377
  validator: import_v43.default.any().meta({
2206
2378
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -2208,21 +2380,27 @@ var QrReaderField = BaseField.extend({
2208
2380
  })
2209
2381
  }).optional()
2210
2382
  }).meta({
2211
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2383
+ description: "QR code reader field, including optional JSON Schema validator.",
2212
2384
  id: "QrReaderField"
2213
2385
  });
2214
2386
  var IdReaderField = BaseField.extend({
2215
2387
  type: import_v43.default.literal(FieldType.ID_READER),
2216
- defaultValue: IdReaderFieldValue.optional(),
2388
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
2217
2389
  methods: import_v43.default.array(
2218
2390
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2219
2391
  )
2392
+ }).meta({
2393
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2394
+ id: "IdReaderField"
2220
2395
  });
2221
2396
  var CustomField = BaseField.extend({
2222
2397
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2223
2398
  defaultValue: CustomFieldValue.optional(),
2224
2399
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2225
2400
  configuration: import_v43.default.unknown().optional()
2401
+ }).meta({
2402
+ description: "An expiremental custom field that is defined by a module source path",
2403
+ id: "CustomField"
2226
2404
  });
2227
2405
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2228
2406
  var LoaderField = BaseField.extend({
@@ -2232,22 +2410,25 @@ var LoaderField = BaseField.extend({
2232
2410
  configuration: import_v43.default.object({
2233
2411
  text: TranslationConfig.describe("Display text above the loading spinner")
2234
2412
  })
2235
- }).describe(
2236
- "A non-interactive field that indicates an in progress operation in form"
2237
- );
2413
+ }).meta({
2414
+ description: "A non-interactive field that indicates an in progress operation in form",
2415
+ id: "LoaderField"
2416
+ });
2238
2417
  var HiddenField = BaseField.extend({
2239
2418
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2240
2419
  required: import_v43.default.boolean().default(false).optional(),
2241
2420
  defaultValue: TextValue.optional()
2242
- }).describe(
2243
- "A non-interactive, hidden field that only hold a value in the form"
2244
- );
2421
+ }).meta({
2422
+ description: "A non-interactive, hidden field that only hold a value in the form",
2423
+ id: "HiddenField"
2424
+ });
2245
2425
  var UserRoleField = BaseField.extend({
2246
2426
  type: import_v43.default.literal(FieldType.USER_ROLE),
2247
2427
  defaultValue: TextValue.optional()
2248
- }).describe(
2249
- "A select dropdown that is automatically populated with available user roles"
2250
- );
2428
+ }).meta({
2429
+ description: "A select dropdown that is automatically populated with available user roles",
2430
+ id: "UserRoleField"
2431
+ });
2251
2432
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2252
2433
  FieldGroup,
2253
2434
  Address,
@@ -2346,16 +2527,19 @@ var VerificationPageConfig = FormPageConfig.extend({
2346
2527
  type: z21.literal(PageTypes.enum.VERIFICATION),
2347
2528
  actions: VerificationActionConfig
2348
2529
  });
2349
- var PageConfig = z21.discriminatedUnion("type", [
2350
- FormPageConfig,
2351
- VerificationPageConfig
2352
- ]);
2530
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2531
+ id: "PageConfig",
2532
+ 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."
2533
+ });
2353
2534
 
2354
2535
  // ../commons/src/events/FormConfig.ts
2355
2536
  var DeclarationFormConfig = z22.object({
2356
2537
  label: TranslationConfig.describe("Human readable description of the form"),
2357
2538
  pages: z22.array(FormPageConfig)
2358
- }).describe("Configuration of the declaration form.");
2539
+ }).meta({
2540
+ id: "DeclarationFormConfig",
2541
+ description: "Configuration of the declaration form."
2542
+ });
2359
2543
  var ActionFormConfig = z22.object({
2360
2544
  label: TranslationConfig.describe("Human readable description of the form"),
2361
2545
  pages: z22.array(PageConfig)
@@ -2455,6 +2639,9 @@ var DeduplicationConfig = z23.object({
2455
2639
  id: z23.string(),
2456
2640
  label: TranslationConfig,
2457
2641
  query: Clause
2642
+ }).meta({
2643
+ id: "DeduplicationConfig",
2644
+ 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."
2458
2645
  });
2459
2646
 
2460
2647
  // ../commons/src/events/ActionConfig.ts
@@ -2492,6 +2679,11 @@ var ReadActionConfig = ActionConfigBase.extend(
2492
2679
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2493
2680
  }).shape
2494
2681
  );
2682
+ var NotifyConfig = ActionConfigBase.extend(
2683
+ z24.object({
2684
+ type: z24.literal(ActionType.NOTIFY)
2685
+ }).shape
2686
+ );
2495
2687
  var DeclareConfig = DeclarationActionBase.extend(
2496
2688
  z24.object({
2497
2689
  type: z24.literal(ActionType.DECLARE),
@@ -2572,17 +2764,46 @@ var ActionConfig = z24.discriminatedUnion("type", [
2572
2764
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2573
2765
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2574
2766
  */
2575
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2576
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2577
- RejectConfig.meta({ id: "RejectActionConfig" }),
2578
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2767
+ ReadActionConfig.meta({
2768
+ id: "ReadActionConfig",
2769
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2770
+ }),
2771
+ NotifyConfig.meta({
2772
+ id: "NotifyActionConfig",
2773
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2774
+ }),
2775
+ DeclareConfig.meta({
2776
+ id: "DeclareActionConfig",
2777
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2778
+ }),
2779
+ RejectConfig.meta({
2780
+ id: "RejectActionConfig",
2781
+ description: "Configuration for rejecting a record before registration."
2782
+ }),
2783
+ RegisterConfig.meta({
2784
+ id: "RegisterActionConfig",
2785
+ description: "Configuration for registering a record."
2786
+ }),
2579
2787
  PrintCertificateActionConfig.meta({
2580
- id: "PrintCertificateActionConfig"
2788
+ id: "PrintCertificateActionConfig",
2789
+ description: "Configuration for printing a certificate of a registered record."
2790
+ }),
2791
+ RequestCorrectionConfig.meta({
2792
+ id: "RequestCorrectionActionConfig",
2793
+ description: "Configuration for requesting a correction on a registered record."
2794
+ }),
2795
+ EditActionConfig.meta({
2796
+ id: "EditActionConfig",
2797
+ description: "Configuration for editing a record before registration."
2581
2798
  }),
2582
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2583
- EditActionConfig.meta({ id: "EditActionConfig" }),
2584
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2585
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2799
+ ArchiveConfig.meta({
2800
+ id: "ArchiveActionConfig",
2801
+ description: "Configuration for archiving a record."
2802
+ }),
2803
+ CustomActionConfig.meta({
2804
+ id: "CustomActionConfig",
2805
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
2806
+ })
2586
2807
  ]).describe(
2587
2808
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2588
2809
  ).meta({ id: "ActionConfig" });
@@ -2658,7 +2879,10 @@ var Field = BaseField2.extend({
2658
2879
  }).describe("Custom field defined for the summary view.");
2659
2880
  var SummaryConfig = z27.object({
2660
2881
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2661
- }).describe("Configuration of the event summary section.");
2882
+ }).meta({
2883
+ id: "SummaryConfig",
2884
+ 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."
2885
+ });
2662
2886
 
2663
2887
  // ../commons/src/events/AdvancedSearchConfig.ts
2664
2888
  var z28 = __toESM(require("zod/v4"));
@@ -2729,6 +2953,9 @@ var BaseField3 = z28.object({
2729
2953
  ),
2730
2954
  validations: z28.array(ValidationConfig).optional().describe(
2731
2955
  `Option for overriding the field validations specifically for advanced search form.`
2956
+ ),
2957
+ allowedLocations: JurisdictionReference.optional().describe(
2958
+ `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.`
2732
2959
  )
2733
2960
  });
2734
2961
  var SearchQueryParams = z28.object({
@@ -2782,6 +3009,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
2782
3009
  var AdvancedSearchConfig = z28.object({
2783
3010
  title: TranslationConfig.describe("Advanced search tab title"),
2784
3011
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3012
+ }).meta({
3013
+ id: "AdvancedSearchConfig",
3014
+ 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()`)."
2785
3015
  });
2786
3016
 
2787
3017
  // ../commons/src/events/utils.ts
@@ -2832,7 +3062,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
2832
3062
  }
2833
3063
  return current;
2834
3064
  }
3065
+ function todayISO() {
3066
+ return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3067
+ }
3068
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
3069
+ function compileClientFunction(code) {
3070
+ let fn = compiledFunctionCache.get(code);
3071
+ if (!fn) {
3072
+ fn = new Function(`return (${code})`)();
3073
+ compiledFunctionCache.set(code, fn);
3074
+ }
3075
+ return fn;
3076
+ }
2835
3077
  (0, import_ajv_formats.default)(ajv);
3078
+ function buildClientFunctionContext(input) {
3079
+ return {
3080
+ $form: input.form,
3081
+ $now: todayISO(),
3082
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3083
+ $online: isOnline(),
3084
+ $user: input.validatorContext?.user,
3085
+ $event: input.validatorContext?.event,
3086
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3087
+ user: input.systemVariables?.user,
3088
+ $window: input.systemVariables?.$window,
3089
+ locations: input.locations,
3090
+ adminLevelIds: input.adminLevelIds
3091
+ };
3092
+ }
3093
+ function runClientFunction(code, data, context) {
3094
+ return compileClientFunction(code)(data, context);
3095
+ }
2836
3096
  ajv.addKeyword({
2837
3097
  keyword: "daysFromDate",
2838
3098
  type: "string",
@@ -2877,12 +3137,35 @@ ajv.addKeyword({
2877
3137
  $data: true,
2878
3138
  errors: true,
2879
3139
  // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
2880
- validate(schema, data, _2, dataContext) {
3140
+ validate(_schema, data, _2, dataContext) {
2881
3141
  const locationIdInput = data;
2882
3142
  const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
2883
3143
  return locations.some((location) => location.id === locationIdInput);
2884
3144
  }
2885
3145
  });
3146
+ ajv.addKeyword({
3147
+ keyword: "customClientValidator",
3148
+ schemaType: "object",
3149
+ errors: true,
3150
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3151
+ // `validate()` callers build root data via `buildClientFunctionContext`,
3152
+ // so the cast holds.
3153
+ validate(schema, data, _2, dataContext) {
3154
+ return Boolean(
3155
+ runClientFunction(
3156
+ schema.code,
3157
+ data,
3158
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3159
+ )
3160
+ );
3161
+ }
3162
+ });
3163
+ function isOnline() {
3164
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3165
+ return navigator.onLine;
3166
+ }
3167
+ return true;
3168
+ }
2886
3169
 
2887
3170
  // ../commons/src/utils.ts
2888
3171
  var z32 = __toESM(require("zod/v4"));
@@ -2925,7 +3208,7 @@ var getActionAnnotationFields = (actionConfig) => {
2925
3208
  if (actionConfig.type === ActionType.CUSTOM) {
2926
3209
  return actionConfig.form;
2927
3210
  }
2928
- if ("review" in actionConfig) {
3211
+ if ("review" in actionConfig && actionConfig.review != null) {
2929
3212
  return actionConfig.review.fields;
2930
3213
  }
2931
3214
  return [];
@@ -3501,7 +3784,54 @@ function createFieldConditionals(fieldId) {
3501
3784
  }
3502
3785
  },
3503
3786
  required: [fieldId]
3504
- })
3787
+ }),
3788
+ /**
3789
+ * Custom client-side validator. The provided function is serialised and executed
3790
+ * just-in-time on the client only. External references (e.g. lodash) are not
3791
+ * available inside the function body — all logic must be self-contained.
3792
+ *
3793
+ * @example
3794
+ * field('nid').customClientValidator((value) => {
3795
+ * // LUHN check — all logic must be inline
3796
+ * const digits = String(value).split('').map(Number)
3797
+ * // ...
3798
+ * return isValid
3799
+ * })
3800
+ */
3801
+ customClientValidator(validationFn) {
3802
+ const code = validationFn.toString();
3803
+ return defineFormConditional({
3804
+ type: "object",
3805
+ properties: wrapToPath(
3806
+ { [fieldId]: { customClientValidator: { code } } },
3807
+ this.$$subfield
3808
+ ),
3809
+ required: [fieldId]
3810
+ });
3811
+ },
3812
+ /**
3813
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
3814
+ * that can be used as the `value` property or a DATA component entry.
3815
+ * The function receives the referenced field's value as the first argument and
3816
+ * the full form context as the second; its return value replaces the field reference.
3817
+ * The function is serialised and executed just-in-time on the client only.
3818
+ * External references (e.g. lodash) are not available inside the function body.
3819
+ *
3820
+ * For computing a default value without referencing a specific field, use
3821
+ * `evaluate(fn)` in the `defaultValue` property instead.
3822
+ *
3823
+ * @example
3824
+ * field('a').customClientEvaluation((aValue, ctx) =>
3825
+ * Number(aValue) + Number(ctx.$form.b)
3826
+ * )
3827
+ */
3828
+ customClientEvaluation(computationFn) {
3829
+ return {
3830
+ $$code: computationFn.toString(),
3831
+ $$field: fieldId,
3832
+ $$subfield: this.$$subfield
3833
+ };
3834
+ }
3505
3835
  };
3506
3836
  }
3507
3837
 
@@ -3649,7 +3979,7 @@ var _EventConfigBase = z33.object({
3649
3979
  ),
3650
3980
  label: TranslationConfig.describe("Human-readable label for the event type."),
3651
3981
  actions: z33.array(ActionConfig).describe(
3652
- "Configuration of system-defined actions associated with the event."
3982
+ "Configuration of core and custom actions associated with the event."
3653
3983
  ),
3654
3984
  actionOrder: z33.array(z33.string()).optional().describe(
3655
3985
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3661,7 +3991,7 @@ var _EventConfigBase = z33.object({
3661
3991
  "Configuration of fields available in the advanced search feature."
3662
3992
  ),
3663
3993
  flags: z33.array(FlagConfig).optional().default([]).describe(
3664
- "Configuration of flags associated with the actions of this event type."
3994
+ "Configuration of custom flags associated with the actions of this event type."
3665
3995
  ),
3666
3996
  analytics: z33.boolean().optional().default(true).describe(
3667
3997
  "Indicates whether the records of this event type are included in analytics"
@@ -3674,8 +4004,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
3674
4004
  validateActionFlags(event2, ctx);
3675
4005
  validateActionOrder(event2, ctx);
3676
4006
  }).meta({
3677
- id: "EventConfig"
3678
- }).describe("Configuration defining an event type.");
4007
+ id: "EventConfig",
4008
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
4009
+ });
3679
4010
 
3680
4011
  // ../commons/src/events/EventConfigInput.ts
3681
4012
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -3897,6 +4228,9 @@ var WorkqueueColumnValue = z34.object({
3897
4228
  var WorkqueueColumn = z34.object({
3898
4229
  label: TranslationConfig,
3899
4230
  value: WorkqueueColumnValue
4231
+ }).meta({
4232
+ id: "WorkqueueColumn",
4233
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
3900
4234
  });
3901
4235
  function defineWorkqueuesColumns(workqueueColumns) {
3902
4236
  return workqueueColumns.map(
@@ -4099,18 +4433,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4099
4433
  query: true,
4100
4434
  columns: true
4101
4435
  });
4102
- var WorkqueueConfigInput = z37.object({
4103
- slug: z37.string().describe("Determines the url of the workqueue."),
4104
- name: TranslationConfig.describe(
4105
- "Title of the workflow (both in navigation and on the page)"
4106
- ),
4107
- query: CountryConfigQueryInputType,
4108
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4109
- "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."
4110
- ),
4111
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4112
- icon: AvailableIcons,
4113
- emptyMessage: TranslationConfig.optional()
4436
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4437
+ query: CountryConfigQueryInputType
4438
+ }).meta({
4439
+ id: "WorkqueueConfig",
4440
+ 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."
4114
4441
  });
4115
4442
  var WorkqueueCountInput = z37.array(
4116
4443
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4150,6 +4477,11 @@ var BaseActionInput = z38.object({
4150
4477
  originalActionId: UUID.optional(),
4151
4478
  // should not be part of base action.
4152
4479
  keepAssignment: z38.boolean().optional(),
4480
+ keepAssignmentIfAccepted: z38.boolean().optional(),
4481
+ keepAssignmentIfRejected: z38.boolean().optional(),
4482
+ waitFor: z38.boolean().default(true).describe(
4483
+ "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."
4484
+ ),
4153
4485
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4154
4486
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4155
4487
  createdAtLocation: UUID.nullish().describe(
@@ -4267,7 +4599,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4267
4599
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4268
4600
  z38.object({
4269
4601
  requestId: z38.string(),
4270
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4602
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4603
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4271
4604
  }).shape
4272
4605
  );
4273
4606
  var ReadActionInput = BaseActionInput.extend(
@@ -4329,7 +4662,7 @@ var Draft = z39.object({
4329
4662
  }).describe(
4330
4663
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4331
4664
  );
4332
- var DraftInput = BaseActionInput.extend({
4665
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4333
4666
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4334
4667
  status: z39.enum([
4335
4668
  ActionStatus.Requested,
@@ -4379,12 +4712,53 @@ var updateActions = ActionTypes.extract([
4379
4712
  ActionType.ARCHIVE,
4380
4713
  ActionType.PRINT_CERTIFICATE,
4381
4714
  ActionType.REQUEST_CORRECTION,
4715
+ ActionType.APPROVE_CORRECTION,
4716
+ ActionType.REJECT_CORRECTION,
4382
4717
  ActionType.CUSTOM
4383
4718
  ]);
4384
4719
 
4385
4720
  // ../commons/src/events/state/flags.ts
4386
4721
  var import_lodash3 = require("lodash");
4387
4722
  var import_date_fns3 = require("date-fns");
4723
+ var INHERENT_FLAG_RULES = [
4724
+ {
4725
+ flag: InherentFlags.CORRECTION_REQUESTED,
4726
+ setOn: [ActionType.REQUEST_CORRECTION],
4727
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4728
+ },
4729
+ {
4730
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4731
+ // other status-changing action (see getStatusFromActions).
4732
+ flag: InherentFlags.INCOMPLETE,
4733
+ setOn: [ActionType.NOTIFY],
4734
+ resetOn: [
4735
+ ActionType.CREATE,
4736
+ ActionType.DECLARE,
4737
+ ActionType.REGISTER,
4738
+ ActionType.ARCHIVE
4739
+ ]
4740
+ },
4741
+ {
4742
+ flag: InherentFlags.REJECTED,
4743
+ setOn: [ActionType.REJECT],
4744
+ resetOn: [
4745
+ ActionType.NOTIFY,
4746
+ ActionType.DECLARE,
4747
+ ActionType.EDIT,
4748
+ ActionType.REGISTER
4749
+ ]
4750
+ },
4751
+ {
4752
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
4753
+ setOn: [ActionType.DUPLICATE_DETECTED],
4754
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4755
+ },
4756
+ {
4757
+ flag: InherentFlags.EDIT_IN_PROGRESS,
4758
+ setOn: [ActionType.EDIT],
4759
+ resetOnAnyOtherAction: true
4760
+ }
4761
+ ];
4388
4762
 
4389
4763
  // ../commons/src/events/defineConfig.ts
4390
4764
  var IGNORED_EVENT_TYPES = [
@@ -5130,6 +5504,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5130
5504
  id: "signature.upload.modal.title",
5131
5505
  defaultMessage: "Draw signature",
5132
5506
  description: "Title for the modal to draw signature"
5507
+ },
5508
+ // Zod applies the schema default at parse time, but this fixture bypasses
5509
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
5510
+ configuration: {
5511
+ maxFileSize: 5 * 1024 * 1024
5133
5512
  }
5134
5513
  }
5135
5514
  ]
@@ -5686,6 +6065,20 @@ var tennisClubMembershipEvent = defineConfig({
5686
6065
  },
5687
6066
  review: TENNIS_CLUB_DECLARATION_REVIEW
5688
6067
  },
6068
+ {
6069
+ type: ActionType.NOTIFY,
6070
+ label: {
6071
+ defaultMessage: "Notify health worker",
6072
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6073
+ id: "event.tennis-club-membership.action.notify.label"
6074
+ },
6075
+ flags: [
6076
+ {
6077
+ id: "health-worker-notified",
6078
+ operation: "add"
6079
+ }
6080
+ ]
6081
+ },
5689
6082
  {
5690
6083
  type: ActionType.REJECT,
5691
6084
  label: {
@@ -5928,6 +6321,17 @@ var tennisClubMembershipEvent = defineConfig({
5928
6321
  }
5929
6322
  }
5930
6323
  ],
6324
+ flags: [
6325
+ {
6326
+ id: "health-worker-notified",
6327
+ requiresAction: false,
6328
+ label: {
6329
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6330
+ defaultMessage: "Health worker notified",
6331
+ description: "Label for the health-worker-notified flag"
6332
+ }
6333
+ }
6334
+ ],
5931
6335
  advancedSearch: [
5932
6336
  {
5933
6337
  title: {
@@ -6923,10 +7327,380 @@ var ACTION_FILTERS = {
6923
7327
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
6924
7328
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
6925
7329
  };
7330
+ var REJECTED_ACTIONS = [
7331
+ ActionType.READ,
7332
+ ActionType.NOTIFY,
7333
+ ActionType.CUSTOM,
7334
+ ActionType.EDIT,
7335
+ ActionType.ARCHIVE
7336
+ ];
6926
7337
 
6927
7338
  // ../commons/src/events/FileUtils.ts
6928
7339
  var import_lodash7 = require("lodash");
6929
7340
 
7341
+ // ../commons/src/events/mocks.test.utils.ts
7342
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7343
+ {
7344
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7345
+ name: "Central",
7346
+ parentId: null,
7347
+ validUntil: null,
7348
+ externalId: "ydyJb1RAy4U1"
7349
+ },
7350
+ {
7351
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7352
+ name: "Sulaka",
7353
+ parentId: null,
7354
+ validUntil: null,
7355
+ externalId: "pQ8nGxWmZ2Q3"
7356
+ },
7357
+ {
7358
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7359
+ name: "Pualula",
7360
+ parentId: null,
7361
+ validUntil: null,
7362
+ externalId: "Aq91DweLmT8k"
7363
+ },
7364
+ {
7365
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7366
+ name: "Chuminga",
7367
+ parentId: null,
7368
+ validUntil: null,
7369
+ externalId: "Rw0fYNh2Xk9a"
7370
+ },
7371
+ {
7372
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7373
+ name: "Ibombo",
7374
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7375
+ validUntil: null,
7376
+ externalId: "k7DsP4vbN1Qe"
7377
+ },
7378
+ {
7379
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
7380
+ name: "Isango",
7381
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7382
+ validUntil: null,
7383
+ externalId: "Gm3Z9eQpHw4L"
7384
+ },
7385
+ {
7386
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7387
+ name: "Isamba",
7388
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7389
+ validUntil: null,
7390
+ externalId: "sT0xVu1KqJ7r"
7391
+ },
7392
+ {
7393
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7394
+ name: "Itambo",
7395
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7396
+ validUntil: null,
7397
+ externalId: "Nq6Bv2HpL9Te"
7398
+ },
7399
+ {
7400
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7401
+ name: "Ezhi",
7402
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7403
+ validUntil: null,
7404
+ externalId: "xK8cQ0ZRy5Wd"
7405
+ },
7406
+ {
7407
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7408
+ name: "Ilanga",
7409
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7410
+ validUntil: null,
7411
+ externalId: "Cq4Jm1XvN8Ls"
7412
+ },
7413
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
7414
+ {
7415
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7416
+ name: "Klow",
7417
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7418
+ validUntil: null,
7419
+ externalId: "IkYcYBUcyY2"
7420
+ },
7421
+ {
7422
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7423
+ name: "Mbondo",
7424
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7425
+ validUntil: null,
7426
+ externalId: "Qhvv5hvo3mY"
7427
+ },
7428
+ {
7429
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7430
+ name: "Ndara",
7431
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7432
+ validUntil: null,
7433
+ externalId: "crXh068O9TR"
7434
+ },
7435
+ {
7436
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7437
+ name: "Olani",
7438
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7439
+ validUntil: null,
7440
+ externalId: "r00It8Tvvp7"
7441
+ },
7442
+ {
7443
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7444
+ name: "Pemba",
7445
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7446
+ validUntil: null,
7447
+ externalId: "ZnUWsbONIaH"
7448
+ },
7449
+ {
7450
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7451
+ name: "Quanza",
7452
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7453
+ validUntil: null,
7454
+ externalId: "fDZycvQTa7l"
7455
+ },
7456
+ {
7457
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7458
+ name: "Rivka",
7459
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7460
+ validUntil: null,
7461
+ externalId: "KqswxCGTELa"
7462
+ },
7463
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
7464
+ {
7465
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7466
+ name: "Mbula",
7467
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7468
+ validUntil: null,
7469
+ externalId: "osEbKjRc9Kg"
7470
+ },
7471
+ {
7472
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7473
+ name: "Ndoki",
7474
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7475
+ validUntil: null,
7476
+ externalId: "aq4daBUAGr3"
7477
+ },
7478
+ {
7479
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7480
+ name: "Tsanga",
7481
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7482
+ validUntil: null,
7483
+ externalId: "cqis6Y8trbJ"
7484
+ },
7485
+ {
7486
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7487
+ name: "Waziri",
7488
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7489
+ validUntil: null,
7490
+ externalId: "LMijHPyyx6d"
7491
+ },
7492
+ {
7493
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7494
+ name: "Zimbi",
7495
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7496
+ validUntil: null,
7497
+ externalId: "pcQYbPuKGZ7"
7498
+ },
7499
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
7500
+ {
7501
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7502
+ name: "Felani",
7503
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7504
+ validUntil: null,
7505
+ externalId: "gSqpoCGdMXp"
7506
+ },
7507
+ {
7508
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7509
+ name: "Goroma",
7510
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7511
+ validUntil: null,
7512
+ externalId: "KvAAIaNqVrp"
7513
+ },
7514
+ {
7515
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7516
+ name: "Halifu",
7517
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7518
+ validUntil: null,
7519
+ externalId: "qe4UnEVt1hv"
7520
+ },
7521
+ {
7522
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7523
+ name: "Jabari",
7524
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7525
+ validUntil: null,
7526
+ externalId: "yHH9Nz4rLOt"
7527
+ },
7528
+ {
7529
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7530
+ name: "Kifani",
7531
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7532
+ validUntil: null,
7533
+ externalId: "eSWmXIGeu1I"
7534
+ },
7535
+ {
7536
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7537
+ name: "Lumela",
7538
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7539
+ validUntil: null,
7540
+ externalId: "bh0b3aI1uP3"
7541
+ }
7542
+ ];
7543
+ var V2_DEFAULT_MOCK_LOCATIONS = [
7544
+ {
7545
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7546
+ name: "Central Provincial Office",
7547
+ locationType: "CRVS_OFFICE",
7548
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7549
+ validUntil: null,
7550
+ externalId: "Xr3Df8WpK6Ys"
7551
+ },
7552
+ {
7553
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7554
+ name: "Central Health Post",
7555
+ locationType: "HEALTH_FACILITY",
7556
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7557
+ validUntil: null
7558
+ },
7559
+ {
7560
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7561
+ name: "Ibombo District Office",
7562
+ locationType: "CRVS_OFFICE",
7563
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7564
+ validUntil: null,
7565
+ externalId: "Sm4Nw7GrD2Vy"
7566
+ },
7567
+ {
7568
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
7569
+ name: "Isamba District Office",
7570
+ locationType: "CRVS_OFFICE",
7571
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7572
+ validUntil: null,
7573
+ externalId: "Vg1Bq5XeH9Lt"
7574
+ },
7575
+ {
7576
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
7577
+ name: "Isango District Office",
7578
+ locationType: "CRVS_OFFICE",
7579
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7580
+ validUntil: null,
7581
+ externalId: "Je7Lm2XqN9Vz"
7582
+ },
7583
+ {
7584
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
7585
+ name: "Sulaka Provincial Office",
7586
+ locationType: "CRVS_OFFICE",
7587
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7588
+ validUntil: null,
7589
+ externalId: "Ht2Wp9KcX5Qv"
7590
+ },
7591
+ {
7592
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
7593
+ name: "Ilanga District Office",
7594
+ locationType: "CRVS_OFFICE",
7595
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7596
+ validUntil: null,
7597
+ externalId: "Yp6Ds1WqN3Xz"
7598
+ },
7599
+ {
7600
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
7601
+ name: "Chamakubi Health Post",
7602
+ locationType: "HEALTH_FACILITY",
7603
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7604
+ validUntil: null,
7605
+ externalId: "M1nFr8LbC2Qy"
7606
+ },
7607
+ {
7608
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
7609
+ name: "Ibombo Rural Health Centre",
7610
+ locationType: "HEALTH_FACILITY",
7611
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7612
+ validUntil: null,
7613
+ externalId: "bT7pV6YrW0Xc"
7614
+ },
7615
+ {
7616
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
7617
+ name: "Chikobo Rural Health Centre",
7618
+ locationType: "HEALTH_FACILITY",
7619
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7620
+ validUntil: null,
7621
+ externalId: "zE4qPn2SgJ5d"
7622
+ },
7623
+ {
7624
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
7625
+ name: "Chilochabalenje Health Post",
7626
+ locationType: "HEALTH_FACILITY",
7627
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7628
+ validUntil: null,
7629
+ externalId: "H8vDs1MqR4Uf"
7630
+ },
7631
+ {
7632
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
7633
+ name: "Chipeso Rural Health Centre",
7634
+ locationType: "HEALTH_FACILITY",
7635
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7636
+ validUntil: null,
7637
+ externalId: "Qw3uZ9KfX6Lm"
7638
+ },
7639
+ {
7640
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
7641
+ name: "Chisamba Rural Health Centre",
7642
+ locationType: "HEALTH_FACILITY",
7643
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7644
+ validUntil: null,
7645
+ externalId: "Yr0pCg8LdM2s"
7646
+ },
7647
+ {
7648
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
7649
+ name: "Chitanda Rural Health Centre",
7650
+ locationType: "HEALTH_FACILITY",
7651
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7652
+ validUntil: null,
7653
+ externalId: "tS9gJ4PwB1Qx"
7654
+ },
7655
+ {
7656
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
7657
+ name: "Golden Valley Rural Health Centre",
7658
+ locationType: "HEALTH_FACILITY",
7659
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7660
+ validUntil: null,
7661
+ externalId: "Ld7Qm3XsA8Vr"
7662
+ },
7663
+ {
7664
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
7665
+ name: "Ipongo Rural Health Centre",
7666
+ locationType: "HEALTH_FACILITY",
7667
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7668
+ validUntil: null,
7669
+ externalId: "kF2sW9DmH0Bt"
7670
+ },
7671
+ {
7672
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
7673
+ name: "Itumbwe Health Post",
7674
+ locationType: "HEALTH_FACILITY",
7675
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7676
+ validUntil: null,
7677
+ externalId: "Ue5Xb3VaC7Pq"
7678
+ },
7679
+ {
7680
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
7681
+ name: "Kabangalala Rural Health Centre",
7682
+ locationType: "HEALTH_FACILITY",
7683
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7684
+ validUntil: null,
7685
+ externalId: "Pz8Kc1TqH6Jn"
7686
+ },
7687
+ // Village offices
7688
+ {
7689
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
7690
+ name: "Klow Village Office",
7691
+ locationType: "CRVS_OFFICE",
7692
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7693
+ validUntil: null,
7694
+ externalId: "PmAyxAJkxiJ"
7695
+ }
7696
+ ];
7697
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7698
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7699
+ );
7700
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7701
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7702
+ );
7703
+
6930
7704
  // ../commons/src/notification/UserNotifications.ts
6931
7705
  var z44 = __toESM(require("zod/v4"));
6932
7706
  var TriggerEvent = {