@opencrvs/toolkit 2.0.0-rc.3dce118 → 2.0.0-rc.3ddb687

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 (130) hide show
  1. package/README.md +15 -0
  2. package/build.sh +5 -4
  3. package/create-countryconfig/index.js +50 -20
  4. package/create-countryconfig/package.json +12 -2
  5. package/dist/application-config/index.js +298 -123
  6. package/dist/cli.js +3223 -4688
  7. package/dist/commons/api/router.d.ts +3954 -211
  8. package/dist/commons/application-config/index.d.ts +1 -0
  9. package/dist/commons/conditionals/conditionals.d.ts +360 -10
  10. package/dist/commons/conditionals/validate.d.ts +52 -2
  11. package/dist/commons/events/ActionConfig.d.ts +230 -2
  12. package/dist/commons/events/ActionDocument.d.ts +50 -0
  13. package/dist/commons/events/ActionInput.d.ts +140 -0
  14. package/dist/commons/events/ActionType.d.ts +6 -1
  15. package/dist/commons/events/AdvancedSearchConfig.d.ts +360 -0
  16. package/dist/commons/events/AuditLog.d.ts +2 -0
  17. package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
  18. package/dist/commons/events/Draft.d.ts +6 -2
  19. package/dist/commons/events/EventConfig.d.ts +2 -0
  20. package/dist/commons/events/EventDocument.d.ts +25 -0
  21. package/dist/commons/events/EventIndex.d.ts +25 -3
  22. package/dist/commons/events/EventMetadata.d.ts +26 -7
  23. package/dist/commons/events/FieldConfig.d.ts +393 -50
  24. package/dist/commons/events/FieldType.d.ts +1 -0
  25. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  26. package/dist/commons/events/FieldValue.d.ts +6 -0
  27. package/dist/commons/events/WorkqueueConfig.d.ts +194 -152
  28. package/dist/commons/events/field.d.ts +53 -1
  29. package/dist/commons/events/index.d.ts +2 -0
  30. package/dist/commons/events/locations.d.ts +1 -0
  31. package/dist/commons/events/scopes.d.ts +1 -0
  32. package/dist/commons/events/state/flags.d.ts +16 -0
  33. package/dist/commons/events/state/index.d.ts +8 -4
  34. package/dist/commons/events/state/utils.d.ts +21 -289
  35. package/dist/commons/events/test.utils.d.ts +9 -1
  36. package/dist/commons/events/utils.d.ts +28 -3
  37. package/dist/conditionals/index.js +65 -5
  38. package/dist/environment/custom-types.d.ts +33 -0
  39. package/dist/environment/custom-types.d.ts.map +1 -0
  40. package/dist/environment/custom-types.js +12 -0
  41. package/dist/environment/derived-variables.d.ts +134 -0
  42. package/dist/environment/derived-variables.d.ts.map +1 -0
  43. package/dist/environment/derived-variables.js +169 -0
  44. package/dist/environment/editor-questions.d.ts +4 -0
  45. package/dist/environment/editor-questions.d.ts.map +1 -0
  46. package/dist/environment/editor-questions.js +67 -0
  47. package/dist/environment/git.d.ts +5 -0
  48. package/dist/environment/git.d.ts.map +1 -0
  49. package/dist/environment/git.js +38 -0
  50. package/dist/environment/github.d.ts +26 -0
  51. package/dist/environment/github.d.ts.map +1 -0
  52. package/dist/environment/github.js +247 -0
  53. package/dist/environment/index.d.ts +5 -0
  54. package/dist/environment/index.d.ts.map +1 -0
  55. package/dist/environment/index.js +71 -0
  56. package/dist/environment/logger.d.ts +15 -0
  57. package/dist/environment/logger.d.ts.map +1 -0
  58. package/dist/environment/logger.js +25 -0
  59. package/dist/environment/manage-users.d.ts +11 -0
  60. package/dist/environment/manage-users.d.ts.map +1 -0
  61. package/dist/environment/manage-users.js +497 -0
  62. package/dist/environment/questions-helper.d.ts +15 -0
  63. package/dist/environment/questions-helper.d.ts.map +1 -0
  64. package/dist/environment/questions-helper.js +70 -0
  65. package/dist/environment/questions.d.ts +199 -0
  66. package/dist/environment/questions.d.ts.map +1 -0
  67. package/dist/environment/questions.js +412 -0
  68. package/dist/environment/setup-environment.d.ts +2 -0
  69. package/dist/environment/setup-environment.d.ts.map +1 -0
  70. package/dist/environment/setup-environment.js +794 -0
  71. package/dist/environment/ssh-keygen.d.ts +5 -0
  72. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  73. package/dist/environment/ssh-keygen.js +21 -0
  74. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  75. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  76. package/dist/environment/swarm-to-k8s.js +173 -0
  77. package/dist/environment/templates.d.ts +27 -0
  78. package/dist/environment/templates.d.ts.map +1 -0
  79. package/dist/environment/templates.js +163 -0
  80. package/dist/environment/update-workflows.d.ts +2 -0
  81. package/dist/environment/update-workflows.d.ts.map +1 -0
  82. package/dist/environment/update-workflows.js +169 -0
  83. package/dist/environment/users.d.ts +2 -0
  84. package/dist/environment/users.d.ts.map +1 -0
  85. package/dist/environment/users.js +112 -0
  86. package/dist/environment/utils.d.ts +18 -0
  87. package/dist/environment/utils.d.ts.map +1 -0
  88. package/dist/environment/utils.js +100 -0
  89. package/dist/events/index.js +1272 -299
  90. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  91. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  92. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  93. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  94. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  95. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  96. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  97. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  98. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  99. package/dist/migrations/v2.0/index.d.ts +5 -3
  100. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  101. package/dist/migrations/v2.0/index.js +88 -4869
  102. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  103. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  104. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  105. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  106. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  107. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  108. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  109. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  110. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  111. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  112. package/dist/migrations/v2.1/index.d.ts +6 -0
  113. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  114. package/dist/migrations/v2.1/index.js +218 -0
  115. package/dist/notification/index.js +1038 -163
  116. package/dist/scopes/index.d.ts +100 -8
  117. package/dist/scopes/index.js +22 -7
  118. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  119. package/dist/templates/charts-values/dependencies/values.yaml +83 -0
  120. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  121. package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
  122. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  123. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  124. package/dist/templates/inventory/inventory.template.yml +100 -0
  125. package/dist/templates/inventory/production.example.yml +77 -0
  126. package/dist/templates/inventory/qa.example.yml +48 -0
  127. package/opencrvs-toolkit-2.0.0-rc.3ddb687.tgz +0 -0
  128. package/package.json +20 -2
  129. package/tsconfig.tsbuildinfo +1 -1
  130. package/opencrvs-toolkit-2.0.0-rc.3dce118.tgz +0 -0
@@ -79,6 +79,7 @@ var RecordScopeTypeV2 = z2.enum([
79
79
  "record.edit",
80
80
  "record.reject",
81
81
  "record.archive",
82
+ "record.unarchive",
82
83
  "record.review-duplicates",
83
84
  "record.register",
84
85
  "record.print-certified-copies",
@@ -118,11 +119,13 @@ var scopeOptionsPlaceEvent = z2.object({
118
119
  event: scopeByEvent,
119
120
  placeOfEvent: JurisdictionFilter.optional()
120
121
  }).describe("Options applicable to all record scopes.");
121
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
122
+ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
123
+ notifiedIn: JurisdictionFilter.optional(),
124
+ notifiedBy: UserFilter.optional(),
122
125
  declaredIn: JurisdictionFilter.optional(),
123
126
  declaredBy: UserFilter.optional()
124
127
  }).describe("Options applicable to actions that may take place after DECLARE");
125
- var AllRecordScopeOptions = scopeOptionsDeclared.extend({
128
+ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
126
129
  registeredIn: JurisdictionFilter.optional(),
127
130
  registeredBy: UserFilter.optional()
128
131
  }).describe(
@@ -160,6 +163,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
160
163
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
161
164
  );
162
165
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
166
+ notifiedIn: UUID.nullish(),
167
+ notifiedBy: z2.string().optional(),
163
168
  declaredIn: UUID.nullish(),
164
169
  declaredBy: z2.string().optional()
165
170
  }).describe(
@@ -180,6 +185,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
180
185
  "record.edit",
181
186
  "record.reject",
182
187
  "record.archive",
188
+ "record.unarchive",
183
189
  "record.review-duplicates",
184
190
  "record.register"
185
191
  ]);
@@ -205,7 +211,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
205
211
  }),
206
212
  z2.object({
207
213
  type: ScopesWithDeclaredOptions,
208
- options: scopeOptionsDeclared.optional()
214
+ options: scopeOptionsDeclaredOrNotified.optional()
209
215
  }),
210
216
  z2.object({
211
217
  type: ScopesWithFullOptions,
@@ -293,7 +299,10 @@ var ScopeType = z2.enum([
293
299
  var EncodedScope = z2.string().brand("EncodedScope");
294
300
  var DEFAULT_SCOPE_OPTIONS = {
295
301
  placeOfEvent: JurisdictionFilter.enum.all,
296
- accessLevel: JurisdictionFilter.enum.all
302
+ accessLevel: JurisdictionFilter.enum.all,
303
+ notifiedIn: JurisdictionFilter.enum.all,
304
+ declaredIn: JurisdictionFilter.enum.all,
305
+ registeredIn: JurisdictionFilter.enum.all
297
306
  };
298
307
 
299
308
  // ../commons/src/authentication.ts
@@ -318,6 +327,7 @@ var ActionType = {
318
327
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
319
328
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
320
329
  ARCHIVE: "ARCHIVE",
330
+ UNARCHIVE: "UNARCHIVE",
321
331
  // Record actions
322
332
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
323
333
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -337,6 +347,7 @@ var ConfirmableActions = [
337
347
  ActionType.REGISTER,
338
348
  ActionType.REJECT,
339
349
  ActionType.ARCHIVE,
350
+ ActionType.UNARCHIVE,
340
351
  ActionType.PRINT_CERTIFICATE,
341
352
  ActionType.REQUEST_CORRECTION,
342
353
  ActionType.APPROVE_CORRECTION,
@@ -355,6 +366,7 @@ var ActionTypes = z4.enum([
355
366
  "MARK_AS_DUPLICATE",
356
367
  "MARK_AS_NOT_DUPLICATE",
357
368
  "ARCHIVE",
369
+ "UNARCHIVE",
358
370
  "PRINT_CERTIFICATE",
359
371
  "REQUEST_CORRECTION",
360
372
  "REJECT_CORRECTION",
@@ -398,6 +410,7 @@ var WorkqueueActionType = ActionTypes.extract([
398
410
  ActionType.REJECT,
399
411
  ActionType.MARK_AS_DUPLICATE,
400
412
  ActionType.ARCHIVE,
413
+ ActionType.UNARCHIVE,
401
414
  ActionType.PRINT_CERTIFICATE,
402
415
  ActionType.REQUEST_CORRECTION
403
416
  ]);
@@ -459,6 +472,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
459
472
  "event.actions.unassign.request",
460
473
  "event.actions.read.request",
461
474
  "event.actions.archive.request",
475
+ "event.actions.unarchive.request",
462
476
  "event.actions.reinstate.request",
463
477
  "event.actions.print_certificate.request",
464
478
  "event.actions.correction.request.request",
@@ -652,7 +666,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
652
666
  ShowConditional,
653
667
  // Action can be shown to the user in the list but as disabled
654
668
  EnableConditional
655
- ]);
669
+ ]).meta({
670
+ id: "ActionConditional",
671
+ 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."
672
+ });
656
673
  var DisplayOnReviewConditional = z7.object({
657
674
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
658
675
  conditional: Conditional
@@ -667,8 +684,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
667
684
  // Field output can be shown / hidden on the review page
668
685
  DisplayOnReviewConditional
669
686
  ]).meta({
670
- description: "Field conditional configuration",
671
- id: "FieldConditional"
687
+ id: "FieldConditional",
688
+ 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."
672
689
  });
673
690
 
674
691
  // ../commons/src/events/FieldType.ts
@@ -765,6 +782,11 @@ var FieldTypesToHideInReview = [
765
782
  FieldType.ALPHA_PRINT_BUTTON,
766
783
  FieldType.ALPHA_HIDDEN
767
784
  ];
785
+ var HiddenFieldTypes = [
786
+ FieldType.HTTP,
787
+ FieldType.QUERY_PARAM_READER,
788
+ FieldType.ALPHA_HIDDEN
789
+ ];
768
790
 
769
791
  // ../commons/src/events/FieldValue.ts
770
792
  var z12 = __toESM(require("zod/v4"));
@@ -883,7 +905,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
883
905
  // ../commons/src/events/FieldValue.ts
884
906
  var TextValue = z12.string();
885
907
  var HiddenFieldValue = z12.string();
886
- var NonEmptyTextValue = TextValue.min(1);
908
+ var NonEmptyTextValue = z12.string().trim().min(1);
887
909
  var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
888
910
  var AgeValue = z12.object({
889
911
  age: z12.number(),
@@ -912,6 +934,7 @@ var DateRangeFieldValue = z12.object({
912
934
  var EmailValue = z12.email();
913
935
  var CheckboxFieldValue = z12.boolean();
914
936
  var NumberFieldValue = z12.number();
937
+ var SignatureFieldValue = FileFieldValue;
915
938
  var ButtonFieldValue = z12.number();
916
939
  var VerificationStatusValue = z12.enum([
917
940
  "verified",
@@ -980,28 +1003,20 @@ function schemaPriority(schema) {
980
1003
  return idx === -1 ? 9999 : idx;
981
1004
  }
982
1005
  function safeUnion(schemas) {
1006
+ const sortedSchemas = [...schemas].sort(
1007
+ (a, b) => schemaPriority(a) - schemaPriority(b)
1008
+ );
983
1009
  return z12.any().superRefine((val, ctx) => {
984
- const successful = schemas.filter((s) => s.safeParse(val).success);
985
- if (successful.length === 1) {
986
- return;
987
- }
988
- if (successful.length === 0) {
989
- ctx.addIssue({
990
- code: "invalid_type",
991
- expected: "custom",
992
- message: "Value does not match any schema"
993
- });
994
- return;
995
- }
996
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
997
- const best = successful[0];
998
- if (!best.safeParse(val).success) {
999
- ctx.addIssue({
1000
- expected: "custom",
1001
- code: "invalid_type",
1002
- message: "Value did not match the best schema"
1003
- });
1010
+ for (const schema of sortedSchemas) {
1011
+ if (schema.safeParse(val).success) {
1012
+ return;
1013
+ }
1004
1014
  }
1015
+ ctx.addIssue({
1016
+ code: "invalid_type",
1017
+ expected: "custom",
1018
+ message: "Value does not match any schema"
1019
+ });
1005
1020
  }).meta({
1006
1021
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1007
1022
  });
@@ -1183,6 +1198,11 @@ var ArchiveAction = ActionBase.extend(
1183
1198
  content: ReasonContent
1184
1199
  }).shape
1185
1200
  );
1201
+ var UnarchiveAction = ActionBase.extend(
1202
+ z14.object({
1203
+ type: z14.literal(ActionType.UNARCHIVE)
1204
+ }).shape
1205
+ );
1186
1206
  var CreatedAction = ActionBase.extend(
1187
1207
  z14.object({
1188
1208
  type: z14.literal(ActionType.CREATE)
@@ -1218,8 +1238,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1218
1238
  var ApprovedCorrectionAction = ActionBase.extend(
1219
1239
  z14.object({
1220
1240
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1221
- requestId: z14.string()
1241
+ requestId: z14.string(),
1222
1242
  // TODO move into 'content' property
1243
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1223
1244
  }).shape
1224
1245
  );
1225
1246
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1248,6 +1269,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1248
1269
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1249
1270
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1250
1271
  ArchiveAction.meta({ id: "ArchiveAction" }),
1272
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1251
1273
  NotifiedAction.meta({ id: "NotifiedAction" }),
1252
1274
  RegisterAction.meta({ id: "RegisterAction" }),
1253
1275
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1311,6 +1333,9 @@ var FlagConfig = z15.object({
1311
1333
  "Indicates if this flag expects an action to be performed to be cleared."
1312
1334
  ),
1313
1335
  label: TranslationConfig.describe("Human readable label of the flag.")
1336
+ }).meta({
1337
+ id: "FlagConfig",
1338
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1314
1339
  });
1315
1340
  var ActionFlagConfig = z15.object({
1316
1341
  id: Flag,
@@ -1318,6 +1343,9 @@ var ActionFlagConfig = z15.object({
1318
1343
  conditional: Conditional.optional().describe(
1319
1344
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1320
1345
  )
1346
+ }).meta({
1347
+ id: "ActionFlagConfig",
1348
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1321
1349
  });
1322
1350
 
1323
1351
  // ../commons/src/events/EventMetadata.ts
@@ -1339,8 +1367,7 @@ var ActionCreationMetadata = z16.object({
1339
1367
  ),
1340
1368
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1341
1369
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1342
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1343
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1370
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1344
1371
  });
1345
1372
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1346
1373
  registrationNumber: z16.string().describe(
@@ -1348,6 +1375,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1348
1375
  )
1349
1376
  });
1350
1377
  var LegalStatuses = z16.object({
1378
+ [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1351
1379
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1352
1380
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1353
1381
  });
@@ -1368,9 +1396,6 @@ var EventMetadata = z16.object({
1368
1396
  createdAtLocation: UUID.nullish().describe(
1369
1397
  "Location of the user who created the event."
1370
1398
  ),
1371
- createdBySignature: DocumentPath.nullish().describe(
1372
- "Signature of the user who created the event."
1373
- ),
1374
1399
  updatedAtLocation: UUID.nullish().describe(
1375
1400
  "Location of the user who last changed the status."
1376
1401
  ),
@@ -1410,6 +1435,8 @@ var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
1410
1435
  var EventMetadataDateFieldIdInput = z16.enum([
1411
1436
  "createdAt",
1412
1437
  "updatedAt",
1438
+ "legalStatuses.NOTIFIED.createdAt",
1439
+ "legalStatuses.NOTIFIED.acceptedAt",
1413
1440
  "legalStatuses.DECLARED.createdAt",
1414
1441
  "legalStatuses.DECLARED.acceptedAt",
1415
1442
  "legalStatuses.REGISTERED.createdAt",
@@ -1418,6 +1445,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
1418
1445
  var EventMetadataDateFieldId = z16.enum([
1419
1446
  "event.createdAt",
1420
1447
  "event.updatedAt",
1448
+ "event.legalStatuses.NOTIFIED.createdAt",
1449
+ "event.legalStatuses.NOTIFIED.acceptedAt",
1421
1450
  "event.legalStatuses.DECLARED.createdAt",
1422
1451
  "event.legalStatuses.DECLARED.acceptedAt",
1423
1452
  "event.legalStatuses.REGISTERED.createdAt",
@@ -1477,7 +1506,8 @@ var Range = import_v4.z.object({
1477
1506
  });
1478
1507
  var ContainsFlags = import_v4.z.object({
1479
1508
  anyOf: import_v4.z.array(Flag).optional(),
1480
- noneOf: import_v4.z.array(Flag).optional()
1509
+ noneOf: import_v4.z.array(Flag).optional(),
1510
+ allOf: import_v4.z.array(Flag).optional()
1481
1511
  }).meta({
1482
1512
  id: "ContainsFlags"
1483
1513
  });
@@ -1663,14 +1693,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1663
1693
  }
1664
1694
  }).describe("Unique identifier for the field");
1665
1695
  var FieldReference = import_v43.default.object({
1666
- $$field: FieldId,
1696
+ $$field: FieldId.describe("Id of the field to reference"),
1667
1697
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1668
1698
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1699
+ ),
1700
+ $$code: import_v43.default.string().optional().describe(
1701
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1702
+ )
1703
+ }).describe(
1704
+ "Reference to a field value, with an optional client-side computation applied."
1705
+ );
1706
+ var ComputedDefaultValue = import_v43.default.object({
1707
+ $$code: import_v43.default.string().describe(
1708
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1669
1709
  )
1670
- }).describe("Reference to a field by its ID");
1710
+ }).describe("A context-only computation used as a field default value.");
1671
1711
  var ValidationConfig = import_v43.default.object({
1672
- validator: Conditional,
1673
- message: TranslationConfig
1712
+ validator: Conditional.describe(
1713
+ "Conditional expression that must hold for the field value to be considered valid."
1714
+ ),
1715
+ message: TranslationConfig.describe(
1716
+ "Error message displayed when the validator does not hold."
1717
+ )
1718
+ }).meta({
1719
+ id: "ValidationConfig",
1720
+ 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."
1674
1721
  });
1675
1722
  var requiredSchema = import_v43.default.union([
1676
1723
  import_v43.default.boolean(),
@@ -1701,7 +1748,7 @@ var BaseField = import_v43.default.object({
1701
1748
  "Indicates whether the field can be modified during record correction."
1702
1749
  ),
1703
1750
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1704
- "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."
1751
+ "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."
1705
1752
  ),
1706
1753
  analytics: import_v43.default.boolean().default(false).optional().describe(
1707
1754
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1709,30 +1756,40 @@ var BaseField = import_v43.default.object({
1709
1756
  }).describe("Common properties shared across all field types.");
1710
1757
  var Divider = BaseField.extend({
1711
1758
  type: import_v43.default.literal(FieldType.DIVIDER)
1759
+ }).meta({
1760
+ description: "A horizontal line divider",
1761
+ id: "Divider"
1712
1762
  });
1713
1763
  var TextField = BaseField.extend({
1714
1764
  type: import_v43.default.literal(FieldType.TEXT),
1715
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1765
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1716
1766
  configuration: import_v43.default.object({
1717
1767
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1718
1768
  type: import_v43.default.enum(["text", "password"]).optional(),
1719
1769
  prefix: TranslationConfig.optional(),
1720
1770
  postfix: TranslationConfig.optional()
1721
1771
  }).default({ type: "text" }).optional()
1722
- }).describe("Text input");
1772
+ }).meta({
1773
+ description: "A text input field",
1774
+ id: "TextField"
1775
+ });
1723
1776
  var NumberField = BaseField.extend({
1724
1777
  type: import_v43.default.literal(FieldType.NUMBER),
1725
- defaultValue: NumberFieldValue.optional(),
1778
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1726
1779
  configuration: import_v43.default.object({
1727
1780
  min: import_v43.default.number().optional().describe("Minimum value"),
1728
1781
  max: import_v43.default.number().optional().describe("Maximum value"),
1782
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1729
1783
  prefix: TranslationConfig.optional(),
1730
1784
  postfix: TranslationConfig.optional()
1731
1785
  }).optional()
1732
- }).describe("Number input");
1786
+ }).meta({
1787
+ description: "A number input field",
1788
+ id: "NumberField"
1789
+ });
1733
1790
  var TextAreaField = BaseField.extend({
1734
1791
  type: import_v43.default.literal(FieldType.TEXTAREA),
1735
- defaultValue: NonEmptyTextValue.optional(),
1792
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1736
1793
  configuration: import_v43.default.object({
1737
1794
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1738
1795
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1740,7 +1797,10 @@ var TextAreaField = BaseField.extend({
1740
1797
  prefix: TranslationConfig.optional(),
1741
1798
  postfix: TranslationConfig.optional()
1742
1799
  }).default({ rows: 4 }).optional()
1743
- }).describe("Multiline text input");
1800
+ }).meta({
1801
+ description: "A multiline text input",
1802
+ id: "TextAreaField"
1803
+ });
1744
1804
  var ImageMimeType = import_v43.default.enum([
1745
1805
  "image/png",
1746
1806
  "image/jpg",
@@ -1763,58 +1823,76 @@ var SignatureField = BaseField.extend({
1763
1823
  signaturePromptLabel: TranslationConfig.describe(
1764
1824
  "Title of the signature modal"
1765
1825
  ),
1766
- defaultValue: FieldValue.optional(),
1826
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1767
1827
  configuration: import_v43.default.object({
1768
1828
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1769
1829
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1770
1830
  }).default({
1771
1831
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1772
1832
  })
1773
- }).describe("Signature input field");
1833
+ }).meta({
1834
+ description: "A signature input field",
1835
+ id: "SignatureField"
1836
+ });
1774
1837
  var EmailField = BaseField.extend({
1775
1838
  type: import_v43.default.literal(FieldType.EMAIL),
1776
1839
  configuration: import_v43.default.object({
1777
1840
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1778
1841
  }).default({ maxLength: 255 }).optional(),
1779
- defaultValue: NonEmptyTextValue.optional()
1842
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1843
+ }).meta({
1844
+ description: "An email input field",
1845
+ id: "EmailField"
1780
1846
  });
1781
1847
  var DateField = BaseField.extend({
1782
1848
  type: import_v43.default.literal(FieldType.DATE),
1783
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1849
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1784
1850
  configuration: import_v43.default.object({
1785
1851
  notice: TranslationConfig.describe(
1786
1852
  "Text to display above the date input"
1787
1853
  ).optional()
1788
1854
  }).optional()
1789
- }).describe("A single date input (yyyy-MM-dd)");
1855
+ }).meta({
1856
+ description: "A date input (yyyy-MM-dd)",
1857
+ id: "DateField"
1858
+ });
1790
1859
  var AgeField = BaseField.extend({
1791
1860
  type: import_v43.default.literal(FieldType.AGE),
1792
- defaultValue: NumberFieldValue.optional(),
1861
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1793
1862
  configuration: import_v43.default.object({
1794
1863
  asOfDate: FieldReference,
1795
1864
  prefix: TranslationConfig.optional(),
1796
1865
  postfix: TranslationConfig.optional()
1797
1866
  })
1798
- }).describe("An age input field which uses the current date as the asOfDate");
1867
+ }).meta({
1868
+ description: "An age input field which uses the current date as the asOfDate",
1869
+ id: "AgeField"
1870
+ });
1799
1871
  var TimeField = BaseField.extend({
1800
1872
  type: import_v43.default.literal(FieldType.TIME),
1801
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1873
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1802
1874
  configuration: import_v43.default.object({
1803
1875
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1804
1876
  notice: TranslationConfig.describe(
1805
1877
  "Text to display above the time input"
1806
1878
  ).optional()
1807
1879
  }).optional()
1808
- }).describe("A single date input (HH-mm)");
1880
+ }).meta({
1881
+ description: "A single time input (HH-mm)",
1882
+ id: "TimeField"
1883
+ });
1809
1884
  var DateRangeField = BaseField.extend({
1810
1885
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1811
- defaultValue: DateRangeFieldValue.optional(),
1886
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1812
1887
  configuration: import_v43.default.object({
1813
1888
  notice: TranslationConfig.describe(
1814
1889
  "Text to display above the date input"
1815
1890
  ).optional()
1816
1891
  }).optional()
1817
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1892
+ }).meta({
1893
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1894
+ id: "DateRangeField"
1895
+ });
1818
1896
  var HtmlFontVariant = import_v43.default.enum([
1819
1897
  "reg12",
1820
1898
  "reg14",
@@ -1858,21 +1936,33 @@ var ImageViewField = BaseField.extend({
1858
1936
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1859
1937
  defaultValue: NonEmptyTextValue.optional(),
1860
1938
  configuration: ImageConfiguration
1861
- }).describe("A read-only image component for form pages");
1939
+ }).meta({
1940
+ description: "A read-only image component for form pages",
1941
+ id: "ImageViewField"
1942
+ });
1862
1943
  var Paragraph = BaseField.extend({
1863
1944
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1864
1945
  configuration: ParagraphConfiguration
1865
- }).describe("A read-only HTML <p> paragraph");
1946
+ }).meta({
1947
+ description: "A read-only HTML <p> paragraph",
1948
+ id: "Paragraph"
1949
+ });
1866
1950
  var Heading = BaseField.extend({
1867
1951
  type: import_v43.default.literal(FieldType.HEADING),
1868
1952
  configuration: HeadingConfiguration
1869
- }).describe("A read-only heading component for form pages");
1953
+ }).meta({
1954
+ description: "A read-only heading component for form pages",
1955
+ id: "Heading"
1956
+ });
1870
1957
  var PageHeader = BaseField.extend({
1871
1958
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1872
- }).describe("A read-only header component for form pages");
1959
+ }).meta({
1960
+ description: "A read-only header component for form pages",
1961
+ id: "PageHeader"
1962
+ });
1873
1963
  var File = BaseField.extend({
1874
1964
  type: import_v43.default.literal(FieldType.FILE),
1875
- defaultValue: FileFieldValue.optional(),
1965
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1876
1966
  configuration: import_v43.default.object({
1877
1967
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1878
1968
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1888,7 +1978,10 @@ var File = BaseField.extend({
1888
1978
  }).default({
1889
1979
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1890
1980
  })
1891
- }).describe("File upload");
1981
+ }).meta({
1982
+ description: "A file upload field",
1983
+ id: "File"
1984
+ });
1892
1985
  var SelectOption = import_v43.default.object({
1893
1986
  value: import_v43.default.string().describe("The value of the option"),
1894
1987
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1896,7 +1989,7 @@ var SelectOption = import_v43.default.object({
1896
1989
  });
1897
1990
  var NumberWithUnitField = BaseField.extend({
1898
1991
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1899
- defaultValue: NumberWithUnitFieldValue.optional(),
1992
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1900
1993
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1901
1994
  configuration: import_v43.default.object({
1902
1995
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1905,17 +1998,23 @@ var NumberWithUnitField = BaseField.extend({
1905
1998
  "Placeholder for the number field"
1906
1999
  )
1907
2000
  }).optional()
1908
- }).describe("Number with unit input");
2001
+ }).meta({
2002
+ description: "A number with unit input field",
2003
+ id: "NumberWithUnitField"
2004
+ });
1909
2005
  var RadioGroup = BaseField.extend({
1910
2006
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1911
- defaultValue: TextValue.optional(),
2007
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1912
2008
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1913
2009
  configuration: import_v43.default.object({
1914
2010
  styles: import_v43.default.object({
1915
2011
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1916
2012
  }).optional()
1917
2013
  }).optional()
1918
- }).describe("Grouped radio options");
2014
+ }).meta({
2015
+ description: "A grouped radio button field",
2016
+ id: "RadioGroup"
2017
+ });
1919
2018
  var BulletList = BaseField.extend({
1920
2019
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1921
2020
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1924,10 +2023,13 @@ var BulletList = BaseField.extend({
1924
2023
  fontVariant: HtmlFontVariant.optional()
1925
2024
  }).optional()
1926
2025
  }).default({})
1927
- }).describe("A list of bullet points");
2026
+ }).meta({
2027
+ description: "A list of bullet points",
2028
+ id: "BulletList"
2029
+ });
1928
2030
  var Select = BaseField.extend({
1929
2031
  type: import_v43.default.literal(FieldType.SELECT),
1930
- defaultValue: TextValue.optional(),
2032
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1931
2033
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1932
2034
  noOptionsMessage: TranslationConfig.optional().describe(
1933
2035
  `
@@ -1939,16 +2041,22 @@ var Select = BaseField.extend({
1939
2041
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1940
2042
  `
1941
2043
  )
1942
- }).describe("Select input");
2044
+ }).meta({
2045
+ description: "A select input field",
2046
+ id: "Select"
2047
+ });
1943
2048
  var SelectDateRangeOption = import_v43.default.object({
1944
2049
  value: SelectDateRangeValue.describe("The value of the option"),
1945
2050
  label: TranslationConfig.describe("The label of the option")
1946
2051
  });
1947
2052
  var SelectDateRangeField = BaseField.extend({
1948
2053
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1949
- defaultValue: SelectDateRangeValue.optional(),
2054
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1950
2055
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1951
- }).describe("Select input with date range options");
2056
+ }).meta({
2057
+ description: "A date range selection field",
2058
+ id: "SelectDateRangeField"
2059
+ });
1952
2060
  var NameConfig = import_v43.default.object({
1953
2061
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1954
2062
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1960,7 +2068,7 @@ var NameField = BaseField.extend({
1960
2068
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1961
2069
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1962
2070
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1963
- }).optional(),
2071
+ }).or(ComputedDefaultValue).optional(),
1964
2072
  configuration: import_v43.default.object({
1965
2073
  name: NameConfig.default({
1966
2074
  firstname: { required: true },
@@ -1979,26 +2087,41 @@ var NameField = BaseField.extend({
1979
2087
  surname: { required: true }
1980
2088
  }
1981
2089
  }).optional()
1982
- }).describe("Name input field");
2090
+ }).meta({
2091
+ description: "A field for entering a persons name",
2092
+ id: "NameField"
2093
+ });
1983
2094
  var PhoneField = BaseField.extend({
1984
- defaultValue: NonEmptyTextValue.optional(),
2095
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1985
2096
  type: import_v43.default.literal(FieldType.PHONE)
1986
- }).describe("Phone input field");
2097
+ }).meta({
2098
+ description: "A field for entering a phone number",
2099
+ id: "PhoneField"
2100
+ });
1987
2101
  var IdField = BaseField.extend({
1988
- defaultValue: NonEmptyTextValue.optional(),
2102
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1989
2103
  type: import_v43.default.literal(FieldType.ID)
1990
- }).describe("ID input field");
2104
+ }).meta({
2105
+ description: "A field for entering an ID",
2106
+ id: "IdField"
2107
+ });
1991
2108
  var Checkbox = BaseField.extend({
1992
2109
  type: import_v43.default.literal(FieldType.CHECKBOX),
1993
- defaultValue: CheckboxFieldValue.default(false)
1994
- }).describe("Boolean checkbox field");
2110
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
2111
+ }).meta({
2112
+ description: "A boolean checkbox field",
2113
+ id: "Checkbox"
2114
+ });
1995
2115
  var Country = BaseField.extend({
1996
2116
  type: import_v43.default.literal(FieldType.COUNTRY),
1997
- defaultValue: NonEmptyTextValue.optional(),
2117
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1998
2118
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1999
2119
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
2000
2120
  )
2001
- }).describe("Country select field");
2121
+ }).meta({
2122
+ description: "A field for selecting a country",
2123
+ id: "Country"
2124
+ });
2002
2125
  var AllowedLocations = JurisdictionReference.optional().describe(
2003
2126
  "Limits which location options are selectable depending on user jurisdiction and location."
2004
2127
  );
@@ -2007,28 +2130,33 @@ var AdministrativeAreas = import_v43.default.enum([
2007
2130
  "HEALTH_FACILITY",
2008
2131
  "CRVS_OFFICE"
2009
2132
  ]);
2010
- var AdministrativeAreaConfiguration = import_v43.default.object({
2011
- partOf: FieldReference.optional().describe("Parent location"),
2012
- type: AdministrativeAreas,
2013
- allowedLocations: AllowedLocations
2014
- }).describe("Administrative area options");
2015
2133
  var AdministrativeAreaField = BaseField.extend({
2016
2134
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
2017
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2018
- configuration: AdministrativeAreaConfiguration
2019
- }).describe("Administrative area input field e.g. facility, office");
2135
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2136
+ configuration: import_v43.default.object({
2137
+ partOf: FieldReference.optional().describe("Parent location"),
2138
+ type: AdministrativeAreas,
2139
+ allowedLocations: AllowedLocations
2140
+ }).describe("Administrative area options")
2141
+ }).meta({
2142
+ description: "Administrative area input field",
2143
+ id: "AdministrativeAreaField"
2144
+ });
2020
2145
  var LocationInput = BaseField.extend({
2021
2146
  type: import_v43.default.literal(FieldType.LOCATION),
2022
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2147
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2023
2148
  configuration: import_v43.default.object({
2024
2149
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2025
2150
  allowedLocations: AllowedLocations
2026
2151
  }).optional()
2027
- }).describe("Input field for a location");
2152
+ }).meta({
2153
+ description: "A field for selecting a location",
2154
+ id: "LocationInput"
2155
+ });
2028
2156
  var FileUploadWithOptions = BaseField.extend({
2029
2157
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2030
2158
  options: import_v43.default.array(SelectOption).describe("A list of options"),
2031
- defaultValue: FileFieldWithOptionValue.optional(),
2159
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
2032
2160
  configuration: import_v43.default.object({
2033
2161
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2034
2162
  maxImageSize: import_v43.default.object({
@@ -2038,15 +2166,18 @@ var FileUploadWithOptions = BaseField.extend({
2038
2166
  }).default({
2039
2167
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2040
2168
  })
2169
+ }).meta({
2170
+ description: "A field for uploading files with file type options",
2171
+ id: "FileUploadWithOptions"
2041
2172
  });
2042
2173
  var Facility = BaseField.extend({
2043
2174
  type: import_v43.default.literal(FieldType.FACILITY),
2044
- defaultValue: NonEmptyTextValue.optional(),
2175
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2045
2176
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2046
2177
  }).describe("Input field for a facility");
2047
2178
  var Office = BaseField.extend({
2048
2179
  type: import_v43.default.literal(FieldType.OFFICE),
2049
- defaultValue: NonEmptyTextValue.optional(),
2180
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2050
2181
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2051
2182
  }).describe("Input field for an office");
2052
2183
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2082,8 +2213,11 @@ var Address = BaseField.extend({
2082
2213
  ).optional(),
2083
2214
  allowedLocations: AllowedLocations
2084
2215
  }).optional(),
2085
- defaultValue: DefaultAddressFieldValue.optional()
2086
- }).describe("Address input field \u2013 a combination of location and text fields");
2216
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2217
+ }).meta({
2218
+ description: "Address input field \u2013 a combination of location and text fields",
2219
+ id: "Address"
2220
+ });
2087
2221
  var StaticDataEntry = import_v43.default.object({
2088
2222
  id: import_v43.default.string().describe("ID for the data entry."),
2089
2223
  label: TranslationConfig,
@@ -2098,7 +2232,10 @@ var DataField = BaseField.extend({
2098
2232
  subtitle: TranslationConfig.optional(),
2099
2233
  data: import_v43.default.array(DataEntry)
2100
2234
  })
2101
- }).describe("Data field for displaying read-only data");
2235
+ }).meta({
2236
+ description: "A field for displaying a table of read-only data",
2237
+ id: "DataField"
2238
+ });
2102
2239
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2103
2240
  var ButtonType = import_v43.default.enum([
2104
2241
  "primary",
@@ -2123,13 +2260,19 @@ var ButtonConfiguration = import_v43.default.object({
2123
2260
  });
2124
2261
  var ButtonField = BaseField.extend({
2125
2262
  type: import_v43.default.literal(FieldType.BUTTON),
2126
- defaultValue: ButtonFieldValue.optional(),
2263
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
2127
2264
  configuration: ButtonConfiguration
2128
- }).describe("Generic button without any built-in functionality");
2265
+ }).meta({
2266
+ description: "A generic button that can be used to trigger an action",
2267
+ id: "ButtonField"
2268
+ });
2129
2269
  var FieldGroup = BaseField.extend({
2130
2270
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2131
2271
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2132
2272
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2273
+ }).meta({
2274
+ description: "A group of fields that are displayed together",
2275
+ id: "FieldGroup"
2133
2276
  });
2134
2277
  var AlphaPrintButton = BaseField.extend({
2135
2278
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2139,10 +2282,13 @@ var AlphaPrintButton = BaseField.extend({
2139
2282
  "Label for the print button"
2140
2283
  )
2141
2284
  })
2142
- }).describe("Print button field for printing certificates");
2285
+ }).meta({
2286
+ description: "An experimental print button field for printing certificates during the declaration process",
2287
+ id: "AlphaPrintButton"
2288
+ });
2143
2289
  var HttpField = BaseField.extend({
2144
2290
  type: import_v43.default.literal(FieldType.HTTP),
2145
- defaultValue: HttpFieldValue.optional(),
2291
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
2146
2292
  configuration: import_v43.default.object({
2147
2293
  trigger: FieldReference.optional().describe(
2148
2294
  "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."
@@ -2155,20 +2301,30 @@ var HttpField = BaseField.extend({
2155
2301
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2156
2302
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2157
2303
  })
2158
- }).describe("HTTP request function triggered by a button click or other event");
2304
+ }).meta({
2305
+ 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.",
2306
+ id: "HttpField"
2307
+ });
2159
2308
  var AutocompleteField = BaseField.extend({
2160
2309
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2161
2310
  configuration: import_v43.default.object({
2162
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2311
+ url: import_v43.default.string().describe(
2312
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2313
+ ).optional(),
2163
2314
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2164
2315
  defaultOptions: import_v43.default.array(
2165
2316
  import_v43.default.object({
2166
2317
  label: import_v43.default.string(),
2167
2318
  value: import_v43.default.string()
2168
2319
  })
2169
- ).optional()
2320
+ ).optional().describe(
2321
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2322
+ )
2170
2323
  })
2171
- }).describe("Autocomplete input field");
2324
+ }).meta({
2325
+ 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.",
2326
+ id: "AutocompleteField"
2327
+ });
2172
2328
  var SearchField = HttpField.extend({
2173
2329
  type: import_v43.default.literal(FieldType.SEARCH),
2174
2330
  configuration: SearchQuery.pick({
@@ -2201,6 +2357,9 @@ var SearchField = HttpField.extend({
2201
2357
  ok: TranslationConfig.optional()
2202
2358
  }).optional()
2203
2359
  })
2360
+ }).meta({
2361
+ description: "A search input field",
2362
+ id: "SearchField"
2204
2363
  });
2205
2364
  var LinkButtonField = BaseField.extend({
2206
2365
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2209,28 +2368,35 @@ var LinkButtonField = BaseField.extend({
2209
2368
  text: TranslationConfig.describe("Text to display on the button"),
2210
2369
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2211
2370
  })
2212
- }).describe("Button that opens a link");
2371
+ }).meta({
2372
+ description: "A button that opens a URL link",
2373
+ id: "LinkButtonField"
2374
+ });
2213
2375
  var VerificationStatus = BaseField.extend({
2214
2376
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2215
- defaultValue: VerificationStatusValue.optional(),
2377
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
2216
2378
  configuration: import_v43.default.object({
2217
2379
  status: TranslationConfig.describe("Text to display on the status pill."),
2218
2380
  description: TranslationConfig.describe(
2219
2381
  "Explaining text on the banner in form."
2220
2382
  )
2221
2383
  })
2384
+ }).meta({
2385
+ 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.",
2386
+ id: "VerificationStatus"
2222
2387
  });
2223
2388
  var QueryParamReaderField = BaseField.extend({
2224
2389
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2225
2390
  configuration: import_v43.default.object({
2226
2391
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2227
2392
  })
2228
- }).describe(
2229
- "A field that maps URL query params into form values and clears them afterward"
2230
- );
2393
+ }).meta({
2394
+ description: "A field that maps URL query params into form values and clears them afterward",
2395
+ id: "QueryParamReaderField"
2396
+ });
2231
2397
  var QrReaderField = BaseField.extend({
2232
2398
  type: import_v43.default.literal(FieldType.QR_READER),
2233
- defaultValue: QrReaderFieldValue.optional(),
2399
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
2234
2400
  configuration: import_v43.default.object({
2235
2401
  validator: import_v43.default.any().meta({
2236
2402
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -2238,21 +2404,27 @@ var QrReaderField = BaseField.extend({
2238
2404
  })
2239
2405
  }).optional()
2240
2406
  }).meta({
2241
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2407
+ description: "QR code reader field, including optional JSON Schema validator.",
2242
2408
  id: "QrReaderField"
2243
2409
  });
2244
2410
  var IdReaderField = BaseField.extend({
2245
2411
  type: import_v43.default.literal(FieldType.ID_READER),
2246
- defaultValue: IdReaderFieldValue.optional(),
2412
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
2247
2413
  methods: import_v43.default.array(
2248
2414
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2249
2415
  )
2416
+ }).meta({
2417
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2418
+ id: "IdReaderField"
2250
2419
  });
2251
2420
  var CustomField = BaseField.extend({
2252
2421
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2253
2422
  defaultValue: CustomFieldValue.optional(),
2254
2423
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2255
2424
  configuration: import_v43.default.unknown().optional()
2425
+ }).meta({
2426
+ description: "An expiremental custom field that is defined by a module source path",
2427
+ id: "CustomField"
2256
2428
  });
2257
2429
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2258
2430
  var LoaderField = BaseField.extend({
@@ -2262,22 +2434,25 @@ var LoaderField = BaseField.extend({
2262
2434
  configuration: import_v43.default.object({
2263
2435
  text: TranslationConfig.describe("Display text above the loading spinner")
2264
2436
  })
2265
- }).describe(
2266
- "A non-interactive field that indicates an in progress operation in form"
2267
- );
2437
+ }).meta({
2438
+ description: "A non-interactive field that indicates an in progress operation in form",
2439
+ id: "LoaderField"
2440
+ });
2268
2441
  var HiddenField = BaseField.extend({
2269
2442
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2270
2443
  required: import_v43.default.boolean().default(false).optional(),
2271
2444
  defaultValue: TextValue.optional()
2272
- }).describe(
2273
- "A non-interactive, hidden field that only hold a value in the form"
2274
- );
2445
+ }).meta({
2446
+ description: "A non-interactive, hidden field that only hold a value in the form",
2447
+ id: "HiddenField"
2448
+ });
2275
2449
  var UserRoleField = BaseField.extend({
2276
2450
  type: import_v43.default.literal(FieldType.USER_ROLE),
2277
2451
  defaultValue: TextValue.optional()
2278
- }).describe(
2279
- "A select dropdown that is automatically populated with available user roles"
2280
- );
2452
+ }).meta({
2453
+ description: "A select dropdown that is automatically populated with available user roles",
2454
+ id: "UserRoleField"
2455
+ });
2281
2456
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2282
2457
  FieldGroup,
2283
2458
  Address,
@@ -2376,16 +2551,19 @@ var VerificationPageConfig = FormPageConfig.extend({
2376
2551
  type: z21.literal(PageTypes.enum.VERIFICATION),
2377
2552
  actions: VerificationActionConfig
2378
2553
  });
2379
- var PageConfig = z21.discriminatedUnion("type", [
2380
- FormPageConfig,
2381
- VerificationPageConfig
2382
- ]);
2554
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2555
+ id: "PageConfig",
2556
+ 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."
2557
+ });
2383
2558
 
2384
2559
  // ../commons/src/events/FormConfig.ts
2385
2560
  var DeclarationFormConfig = z22.object({
2386
2561
  label: TranslationConfig.describe("Human readable description of the form"),
2387
2562
  pages: z22.array(FormPageConfig)
2388
- }).describe("Configuration of the declaration form.");
2563
+ }).meta({
2564
+ id: "DeclarationFormConfig",
2565
+ description: "Configuration of the declaration form."
2566
+ });
2389
2567
  var ActionFormConfig = z22.object({
2390
2568
  label: TranslationConfig.describe("Human readable description of the form"),
2391
2569
  pages: z22.array(PageConfig)
@@ -2485,6 +2663,9 @@ var DeduplicationConfig = z23.object({
2485
2663
  id: z23.string(),
2486
2664
  label: TranslationConfig,
2487
2665
  query: Clause
2666
+ }).meta({
2667
+ id: "DeduplicationConfig",
2668
+ 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."
2488
2669
  });
2489
2670
 
2490
2671
  // ../commons/src/events/ActionConfig.ts
@@ -2522,6 +2703,57 @@ var ReadActionConfig = ActionConfigBase.extend(
2522
2703
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2523
2704
  }).shape
2524
2705
  );
2706
+ var NotifyConfig = ActionConfigBase.extend(
2707
+ z24.object({
2708
+ type: z24.literal(ActionType.NOTIFY)
2709
+ }).shape
2710
+ );
2711
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
2712
+ z24.object({
2713
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2714
+ label: z24.never().optional().describe(
2715
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2716
+ ),
2717
+ supportingCopy: z24.never().optional(),
2718
+ icon: z24.never().optional().describe(
2719
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2720
+ ),
2721
+ conditionals: z24.never().optional().describe(
2722
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2723
+ )
2724
+ }).shape
2725
+ );
2726
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2727
+ z24.object({
2728
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2729
+ }).shape
2730
+ );
2731
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2732
+ z24.object({
2733
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2734
+ }).shape
2735
+ );
2736
+ var AssignConfig = ActionConfigBase.extend(
2737
+ z24.object({
2738
+ type: z24.literal(ActionType.ASSIGN),
2739
+ flags: z24.never().optional().describe(
2740
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2741
+ )
2742
+ }).shape
2743
+ );
2744
+ var UnassignConfig = ActionConfigBase.extend(
2745
+ z24.object({
2746
+ type: z24.literal(ActionType.UNASSIGN),
2747
+ flags: z24.never().optional().describe(
2748
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2749
+ )
2750
+ }).shape
2751
+ );
2752
+ var DeleteConfig = ActionConfigBase.extend(
2753
+ z24.object({
2754
+ type: z24.literal(ActionType.DELETE)
2755
+ }).shape
2756
+ );
2525
2757
  var DeclareConfig = DeclarationActionBase.extend(
2526
2758
  z24.object({
2527
2759
  type: z24.literal(ActionType.DECLARE),
@@ -2546,6 +2778,11 @@ var ArchiveConfig = ActionConfigBase.extend(
2546
2778
  type: z24.literal(ActionType.ARCHIVE)
2547
2779
  }).shape
2548
2780
  );
2781
+ var UnarchiveConfig = ActionConfigBase.extend(
2782
+ z24.object({
2783
+ type: z24.literal(ActionType.UNARCHIVE)
2784
+ }).shape
2785
+ );
2549
2786
  var EditActionConfig = ActionConfigBase.extend(
2550
2787
  z24.object({
2551
2788
  type: z24.literal(ActionType.EDIT),
@@ -2584,7 +2821,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2584
2821
  correctionForm: ActionFormConfig
2585
2822
  }).shape
2586
2823
  );
2587
- var CustomActionConfig = ActionConfigBase.merge(
2824
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2825
+ z24.object({
2826
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2827
+ }).shape
2828
+ );
2829
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2830
+ z24.object({
2831
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2832
+ }).shape
2833
+ );
2834
+ var CustomActionConfig = ActionConfigBase.extend(
2588
2835
  z24.object({
2589
2836
  type: z24.literal(ActionType.CUSTOM),
2590
2837
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2595,24 +2842,89 @@ var CustomActionConfig = ActionConfigBase.merge(
2595
2842
  auditHistoryLabel: TranslationConfig.describe(
2596
2843
  'The label to show in audit history for this action. For example "Approved".'
2597
2844
  )
2598
- })
2845
+ }).shape
2599
2846
  );
2600
2847
  var ActionConfig = z24.discriminatedUnion("type", [
2601
2848
  /*
2602
2849
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2603
2850
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2604
2851
  */
2605
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2606
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2607
- RejectConfig.meta({ id: "RejectActionConfig" }),
2608
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2852
+ ReadActionConfig.meta({
2853
+ id: "ReadActionConfig",
2854
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2855
+ }),
2856
+ AssignConfig.meta({
2857
+ id: "AssignActionConfig",
2858
+ description: "Configuration for assigning a record to the current user."
2859
+ }),
2860
+ UnassignConfig.meta({
2861
+ id: "UnassignActionConfig",
2862
+ description: "Configuration for unassigning a record from its current assignee."
2863
+ }),
2864
+ DeleteConfig.meta({
2865
+ id: "DeleteActionConfig",
2866
+ description: "Configuration for deleting a draft record."
2867
+ }),
2868
+ NotifyConfig.meta({
2869
+ id: "NotifyActionConfig",
2870
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2871
+ }),
2872
+ DeclareConfig.meta({
2873
+ id: "DeclareActionConfig",
2874
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2875
+ }),
2876
+ DuplicateDetectedConfig.meta({
2877
+ id: "DuplicateDetectedActionConfig",
2878
+ description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
2879
+ }),
2880
+ MarkAsDuplicateConfig.meta({
2881
+ id: "MarkAsDuplicateActionConfig",
2882
+ description: "Configuration for marking a record as a duplicate."
2883
+ }),
2884
+ MarkAsNotDuplicateConfig.meta({
2885
+ id: "MarkAsNotDuplicateActionConfig",
2886
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2887
+ }),
2888
+ RejectConfig.meta({
2889
+ id: "RejectActionConfig",
2890
+ description: "Configuration for rejecting a record before registration."
2891
+ }),
2892
+ RegisterConfig.meta({
2893
+ id: "RegisterActionConfig",
2894
+ description: "Configuration for registering a record."
2895
+ }),
2609
2896
  PrintCertificateActionConfig.meta({
2610
- id: "PrintCertificateActionConfig"
2897
+ id: "PrintCertificateActionConfig",
2898
+ description: "Configuration for printing a certificate of a registered record."
2899
+ }),
2900
+ RequestCorrectionConfig.meta({
2901
+ id: "RequestCorrectionActionConfig",
2902
+ description: "Configuration for requesting a correction on a registered record."
2903
+ }),
2904
+ ApproveCorrectionConfig.meta({
2905
+ id: "ApproveCorrectionActionConfig",
2906
+ description: "Configuration for approving a requested correction."
2907
+ }),
2908
+ RejectCorrectionConfig.meta({
2909
+ id: "RejectCorrectionActionConfig",
2910
+ description: "Configuration for rejecting a requested correction."
2611
2911
  }),
2612
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2613
- EditActionConfig.meta({ id: "EditActionConfig" }),
2614
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2615
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2912
+ EditActionConfig.meta({
2913
+ id: "EditActionConfig",
2914
+ description: "Configuration for editing a record before registration."
2915
+ }),
2916
+ ArchiveConfig.meta({
2917
+ id: "ArchiveActionConfig",
2918
+ description: "Configuration for archiving a record."
2919
+ }),
2920
+ UnarchiveConfig.meta({
2921
+ id: "UnarchiveActionConfig",
2922
+ description: "Configuration for unarchiving a record."
2923
+ }),
2924
+ CustomActionConfig.meta({
2925
+ id: "CustomActionConfig",
2926
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
2927
+ })
2616
2928
  ]).describe(
2617
2929
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2618
2930
  ).meta({ id: "ActionConfig" });
@@ -2688,7 +3000,10 @@ var Field = BaseField2.extend({
2688
3000
  }).describe("Custom field defined for the summary view.");
2689
3001
  var SummaryConfig = z27.object({
2690
3002
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2691
- }).describe("Configuration of the event summary section.");
3003
+ }).meta({
3004
+ id: "SummaryConfig",
3005
+ 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."
3006
+ });
2692
3007
 
2693
3008
  // ../commons/src/events/AdvancedSearchConfig.ts
2694
3009
  var z28 = __toESM(require("zod/v4"));
@@ -2759,6 +3074,9 @@ var BaseField3 = z28.object({
2759
3074
  ),
2760
3075
  validations: z28.array(ValidationConfig).optional().describe(
2761
3076
  `Option for overriding the field validations specifically for advanced search form.`
3077
+ ),
3078
+ allowedLocations: JurisdictionReference.optional().describe(
3079
+ `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.`
2762
3080
  )
2763
3081
  });
2764
3082
  var SearchQueryParams = z28.object({
@@ -2812,6 +3130,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
2812
3130
  var AdvancedSearchConfig = z28.object({
2813
3131
  title: TranslationConfig.describe("Advanced search tab title"),
2814
3132
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3133
+ }).meta({
3134
+ id: "AdvancedSearchConfig",
3135
+ 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()`)."
2815
3136
  });
2816
3137
 
2817
3138
  // ../commons/src/events/utils.ts
@@ -2862,7 +3183,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
2862
3183
  }
2863
3184
  return current;
2864
3185
  }
3186
+ function todayISO() {
3187
+ return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3188
+ }
3189
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
3190
+ function compileClientFunction(code) {
3191
+ let fn = compiledFunctionCache.get(code);
3192
+ if (!fn) {
3193
+ fn = new Function(`return (${code})`)();
3194
+ compiledFunctionCache.set(code, fn);
3195
+ }
3196
+ return fn;
3197
+ }
2865
3198
  (0, import_ajv_formats.default)(ajv);
3199
+ function buildClientFunctionContext(input) {
3200
+ return {
3201
+ $form: input.form,
3202
+ $now: todayISO(),
3203
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3204
+ $online: isOnline(),
3205
+ $user: input.validatorContext?.user,
3206
+ $event: input.validatorContext?.event,
3207
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3208
+ user: input.systemVariables?.user,
3209
+ $window: input.systemVariables?.$window,
3210
+ locations: input.locations,
3211
+ adminLevelIds: input.adminLevelIds
3212
+ };
3213
+ }
3214
+ function runClientFunction(code, data, context) {
3215
+ return compileClientFunction(code)(data, context);
3216
+ }
2866
3217
  ajv.addKeyword({
2867
3218
  keyword: "daysFromDate",
2868
3219
  type: "string",
@@ -2907,12 +3258,35 @@ ajv.addKeyword({
2907
3258
  $data: true,
2908
3259
  errors: true,
2909
3260
  // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
2910
- validate(schema, data, _2, dataContext) {
3261
+ validate(_schema, data, _2, dataContext) {
2911
3262
  const locationIdInput = data;
2912
3263
  const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
2913
3264
  return locations.some((location) => location.id === locationIdInput);
2914
3265
  }
2915
3266
  });
3267
+ ajv.addKeyword({
3268
+ keyword: "customClientValidator",
3269
+ schemaType: "object",
3270
+ errors: true,
3271
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3272
+ // `validate()` callers build root data via `buildClientFunctionContext`,
3273
+ // so the cast holds.
3274
+ validate(schema, data, _2, dataContext) {
3275
+ return Boolean(
3276
+ runClientFunction(
3277
+ schema.code,
3278
+ data,
3279
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3280
+ )
3281
+ );
3282
+ }
3283
+ });
3284
+ function isOnline() {
3285
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3286
+ return navigator.onLine;
3287
+ }
3288
+ return true;
3289
+ }
2916
3290
 
2917
3291
  // ../commons/src/utils.ts
2918
3292
  var z32 = __toESM(require("zod/v4"));
@@ -2955,7 +3329,7 @@ var getActionAnnotationFields = (actionConfig) => {
2955
3329
  if (actionConfig.type === ActionType.CUSTOM) {
2956
3330
  return actionConfig.form;
2957
3331
  }
2958
- if ("review" in actionConfig) {
3332
+ if ("review" in actionConfig && actionConfig.review != null) {
2959
3333
  return actionConfig.review.fields;
2960
3334
  }
2961
3335
  return [];
@@ -3531,7 +3905,54 @@ function createFieldConditionals(fieldId) {
3531
3905
  }
3532
3906
  },
3533
3907
  required: [fieldId]
3534
- })
3908
+ }),
3909
+ /**
3910
+ * Custom client-side validator. The provided function is serialised and executed
3911
+ * just-in-time on the client only. External references (e.g. lodash) are not
3912
+ * available inside the function body — all logic must be self-contained.
3913
+ *
3914
+ * @example
3915
+ * field('nid').customClientValidator((value) => {
3916
+ * // LUHN check — all logic must be inline
3917
+ * const digits = String(value).split('').map(Number)
3918
+ * // ...
3919
+ * return isValid
3920
+ * })
3921
+ */
3922
+ customClientValidator(validationFn) {
3923
+ const code = validationFn.toString();
3924
+ return defineFormConditional({
3925
+ type: "object",
3926
+ properties: wrapToPath(
3927
+ { [fieldId]: { customClientValidator: { code } } },
3928
+ this.$$subfield
3929
+ ),
3930
+ required: [fieldId]
3931
+ });
3932
+ },
3933
+ /**
3934
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
3935
+ * that can be used as the `value` property or a DATA component entry.
3936
+ * The function receives the referenced field's value as the first argument and
3937
+ * the full form context as the second; its return value replaces the field reference.
3938
+ * The function is serialised and executed just-in-time on the client only.
3939
+ * External references (e.g. lodash) are not available inside the function body.
3940
+ *
3941
+ * For computing a default value without referencing a specific field, use
3942
+ * `evaluate(fn)` in the `defaultValue` property instead.
3943
+ *
3944
+ * @example
3945
+ * field('a').customClientEvaluation((aValue, ctx) =>
3946
+ * Number(aValue) + Number(ctx.$form.b)
3947
+ * )
3948
+ */
3949
+ customClientEvaluation(computationFn) {
3950
+ return {
3951
+ $$code: computationFn.toString(),
3952
+ $$field: fieldId,
3953
+ $$subfield: this.$$subfield
3954
+ };
3955
+ }
3535
3956
  };
3536
3957
  }
3537
3958
 
@@ -3619,7 +4040,7 @@ function validateActionFlags(event2, ctx) {
3619
4040
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3620
4041
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3621
4042
  const actionFlagIds = event2.actions.flatMap(
3622
- (action) => action.flags.map((flag) => flag.id)
4043
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3623
4044
  );
3624
4045
  for (const actionFlagId of actionFlagIds) {
3625
4046
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -3679,7 +4100,7 @@ var _EventConfigBase = z33.object({
3679
4100
  ),
3680
4101
  label: TranslationConfig.describe("Human-readable label for the event type."),
3681
4102
  actions: z33.array(ActionConfig).describe(
3682
- "Configuration of system-defined actions associated with the event."
4103
+ "Configuration of core and custom actions associated with the event."
3683
4104
  ),
3684
4105
  actionOrder: z33.array(z33.string()).optional().describe(
3685
4106
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3691,7 +4112,7 @@ var _EventConfigBase = z33.object({
3691
4112
  "Configuration of fields available in the advanced search feature."
3692
4113
  ),
3693
4114
  flags: z33.array(FlagConfig).optional().default([]).describe(
3694
- "Configuration of flags associated with the actions of this event type."
4115
+ "Configuration of custom flags associated with the actions of this event type."
3695
4116
  ),
3696
4117
  analytics: z33.boolean().optional().default(true).describe(
3697
4118
  "Indicates whether the records of this event type are included in analytics"
@@ -3704,8 +4125,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
3704
4125
  validateActionFlags(event2, ctx);
3705
4126
  validateActionOrder(event2, ctx);
3706
4127
  }).meta({
3707
- id: "EventConfig"
3708
- }).describe("Configuration defining an event type.");
4128
+ id: "EventConfig",
4129
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
4130
+ });
3709
4131
 
3710
4132
  // ../commons/src/events/EventConfigInput.ts
3711
4133
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -3927,6 +4349,9 @@ var WorkqueueColumnValue = z34.object({
3927
4349
  var WorkqueueColumn = z34.object({
3928
4350
  label: TranslationConfig,
3929
4351
  value: WorkqueueColumnValue
4352
+ }).meta({
4353
+ id: "WorkqueueColumn",
4354
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
3930
4355
  });
3931
4356
  function defineWorkqueuesColumns(workqueueColumns) {
3932
4357
  return workqueueColumns.map(
@@ -4129,18 +4554,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4129
4554
  query: true,
4130
4555
  columns: true
4131
4556
  });
4132
- var WorkqueueConfigInput = z37.object({
4133
- slug: z37.string().describe("Determines the url of the workqueue."),
4134
- name: TranslationConfig.describe(
4135
- "Title of the workflow (both in navigation and on the page)"
4136
- ),
4137
- query: CountryConfigQueryInputType,
4138
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4139
- "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."
4140
- ),
4141
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4142
- icon: AvailableIcons,
4143
- emptyMessage: TranslationConfig.optional()
4557
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4558
+ query: CountryConfigQueryInputType
4559
+ }).meta({
4560
+ id: "WorkqueueConfig",
4561
+ 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."
4144
4562
  });
4145
4563
  var WorkqueueCountInput = z37.array(
4146
4564
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4180,6 +4598,11 @@ var BaseActionInput = z38.object({
4180
4598
  originalActionId: UUID.optional(),
4181
4599
  // should not be part of base action.
4182
4600
  keepAssignment: z38.boolean().optional(),
4601
+ keepAssignmentIfAccepted: z38.boolean().optional(),
4602
+ keepAssignmentIfRejected: z38.boolean().optional(),
4603
+ waitFor: z38.boolean().default(true).describe(
4604
+ "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."
4605
+ ),
4183
4606
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4184
4607
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4185
4608
  createdAtLocation: UUID.nullish().describe(
@@ -4270,6 +4693,11 @@ var ArchiveActionInput = BaseActionInput.extend(
4270
4693
  content: ReasonContent
4271
4694
  }).shape
4272
4695
  );
4696
+ var UnarchiveActionInput = BaseActionInput.extend(
4697
+ z38.object({
4698
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4699
+ }).shape
4700
+ );
4273
4701
  var AssignActionInput = BaseActionInput.extend(
4274
4702
  z38.object({
4275
4703
  type: z38.literal(ActionType.ASSIGN),
@@ -4297,7 +4725,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4297
4725
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4298
4726
  z38.object({
4299
4727
  requestId: z38.string(),
4300
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4728
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4729
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4301
4730
  }).shape
4302
4731
  );
4303
4732
  var ReadActionInput = BaseActionInput.extend(
@@ -4330,6 +4759,7 @@ var ActionInput = z38.discriminatedUnion("type", [
4330
4759
  id: "MarkNotDuplicateActionInput"
4331
4760
  }),
4332
4761
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4762
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
4333
4763
  AssignActionInput.meta({ id: "AssignActionInput" }),
4334
4764
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
4335
4765
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -4359,7 +4789,7 @@ var Draft = z39.object({
4359
4789
  }).describe(
4360
4790
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4361
4791
  );
4362
- var DraftInput = BaseActionInput.extend({
4792
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4363
4793
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4364
4794
  status: z39.enum([
4365
4795
  ActionStatus.Requested,
@@ -4407,14 +4837,53 @@ var updateActions = ActionTypes.extract([
4407
4837
  ActionType.REGISTER,
4408
4838
  ActionType.REJECT,
4409
4839
  ActionType.ARCHIVE,
4840
+ ActionType.UNARCHIVE,
4410
4841
  ActionType.PRINT_CERTIFICATE,
4411
4842
  ActionType.REQUEST_CORRECTION,
4843
+ ActionType.APPROVE_CORRECTION,
4844
+ ActionType.REJECT_CORRECTION,
4412
4845
  ActionType.CUSTOM
4413
4846
  ]);
4414
4847
 
4415
4848
  // ../commons/src/events/state/flags.ts
4416
4849
  var import_lodash3 = require("lodash");
4417
4850
  var import_date_fns3 = require("date-fns");
4851
+ var INHERENT_FLAG_RULES = [
4852
+ {
4853
+ flag: InherentFlags.CORRECTION_REQUESTED,
4854
+ setOn: [ActionType.REQUEST_CORRECTION],
4855
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4856
+ },
4857
+ {
4858
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4859
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
4860
+ // are deliberately excluded so the flag freezes across an archive/unarchive
4861
+ // round trip and comes back exactly as it was.
4862
+ flag: InherentFlags.INCOMPLETE,
4863
+ setOn: [ActionType.NOTIFY],
4864
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4865
+ },
4866
+ {
4867
+ flag: InherentFlags.REJECTED,
4868
+ setOn: [ActionType.REJECT],
4869
+ resetOn: [
4870
+ ActionType.NOTIFY,
4871
+ ActionType.DECLARE,
4872
+ ActionType.EDIT,
4873
+ ActionType.REGISTER
4874
+ ]
4875
+ },
4876
+ {
4877
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
4878
+ setOn: [ActionType.DUPLICATE_DETECTED],
4879
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4880
+ },
4881
+ {
4882
+ flag: InherentFlags.EDIT_IN_PROGRESS,
4883
+ setOn: [ActionType.EDIT],
4884
+ resetOnAnyOtherAction: true
4885
+ }
4886
+ ];
4418
4887
 
4419
4888
  // ../commons/src/events/defineConfig.ts
4420
4889
  var IGNORED_EVENT_TYPES = [
@@ -5160,6 +5629,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5160
5629
  id: "signature.upload.modal.title",
5161
5630
  defaultMessage: "Draw signature",
5162
5631
  description: "Title for the modal to draw signature"
5632
+ },
5633
+ // Zod applies the schema default at parse time, but this fixture bypasses
5634
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
5635
+ configuration: {
5636
+ maxFileSize: 5 * 1024 * 1024
5163
5637
  }
5164
5638
  }
5165
5639
  ]
@@ -5716,6 +6190,20 @@ var tennisClubMembershipEvent = defineConfig({
5716
6190
  },
5717
6191
  review: TENNIS_CLUB_DECLARATION_REVIEW
5718
6192
  },
6193
+ {
6194
+ type: ActionType.NOTIFY,
6195
+ label: {
6196
+ defaultMessage: "Notify health worker",
6197
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6198
+ id: "event.tennis-club-membership.action.notify.label"
6199
+ },
6200
+ flags: [
6201
+ {
6202
+ id: "health-worker-notified",
6203
+ operation: "add"
6204
+ }
6205
+ ]
6206
+ },
5719
6207
  {
5720
6208
  type: ActionType.REJECT,
5721
6209
  label: {
@@ -5958,6 +6446,17 @@ var tennisClubMembershipEvent = defineConfig({
5958
6446
  }
5959
6447
  }
5960
6448
  ],
6449
+ flags: [
6450
+ {
6451
+ id: "health-worker-notified",
6452
+ requiresAction: false,
6453
+ label: {
6454
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6455
+ defaultMessage: "Health worker notified",
6456
+ description: "Label for the health-worker-notified flag"
6457
+ }
6458
+ }
6459
+ ],
5961
6460
  advancedSearch: [
5962
6461
  {
5963
6462
  title: {
@@ -6894,6 +7393,7 @@ var ACTION_SCOPE_MAP = {
6894
7393
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
6895
7394
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
6896
7395
  [ActionType.ARCHIVE]: ["record.archive"],
7396
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
6897
7397
  [ActionType.REJECT]: ["record.reject"],
6898
7398
  [ActionType.ASSIGN]: null,
6899
7399
  [ActionType.UNASSIGN]: null,
@@ -6936,7 +7436,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6936
7436
  ActionType.CUSTOM,
6937
7437
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
6938
7438
  ],
6939
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
7439
+ [EventStatus.enum.ARCHIVED]: [
7440
+ ActionType.READ,
7441
+ ActionType.CUSTOM,
7442
+ ActionType.UNARCHIVE
7443
+ ]
6940
7444
  };
6941
7445
  var ACTION_FILTERS = {
6942
7446
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
@@ -6949,14 +7453,385 @@ var ACTION_FILTERS = {
6949
7453
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6950
7454
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
6951
7455
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7456
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
6952
7457
  [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
6953
7458
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
6954
7459
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
6955
7460
  };
7461
+ var REJECTED_ACTIONS = [
7462
+ ActionType.READ,
7463
+ ActionType.NOTIFY,
7464
+ ActionType.CUSTOM,
7465
+ ActionType.EDIT,
7466
+ ActionType.ARCHIVE
7467
+ ];
6956
7468
 
6957
7469
  // ../commons/src/events/FileUtils.ts
6958
7470
  var import_lodash7 = require("lodash");
6959
7471
 
7472
+ // ../commons/src/events/mocks.test.utils.ts
7473
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7474
+ {
7475
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7476
+ name: "Central",
7477
+ parentId: null,
7478
+ validUntil: null,
7479
+ externalId: "ydyJb1RAy4U1"
7480
+ },
7481
+ {
7482
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7483
+ name: "Sulaka",
7484
+ parentId: null,
7485
+ validUntil: null,
7486
+ externalId: "pQ8nGxWmZ2Q3"
7487
+ },
7488
+ {
7489
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7490
+ name: "Pualula",
7491
+ parentId: null,
7492
+ validUntil: null,
7493
+ externalId: "Aq91DweLmT8k"
7494
+ },
7495
+ {
7496
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7497
+ name: "Chuminga",
7498
+ parentId: null,
7499
+ validUntil: null,
7500
+ externalId: "Rw0fYNh2Xk9a"
7501
+ },
7502
+ {
7503
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7504
+ name: "Ibombo",
7505
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7506
+ validUntil: null,
7507
+ externalId: "k7DsP4vbN1Qe"
7508
+ },
7509
+ {
7510
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
7511
+ name: "Isango",
7512
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7513
+ validUntil: null,
7514
+ externalId: "Gm3Z9eQpHw4L"
7515
+ },
7516
+ {
7517
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7518
+ name: "Isamba",
7519
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7520
+ validUntil: null,
7521
+ externalId: "sT0xVu1KqJ7r"
7522
+ },
7523
+ {
7524
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7525
+ name: "Itambo",
7526
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7527
+ validUntil: null,
7528
+ externalId: "Nq6Bv2HpL9Te"
7529
+ },
7530
+ {
7531
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7532
+ name: "Ezhi",
7533
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7534
+ validUntil: null,
7535
+ externalId: "xK8cQ0ZRy5Wd"
7536
+ },
7537
+ {
7538
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7539
+ name: "Ilanga",
7540
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7541
+ validUntil: null,
7542
+ externalId: "Cq4Jm1XvN8Ls"
7543
+ },
7544
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
7545
+ {
7546
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7547
+ name: "Klow",
7548
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7549
+ validUntil: null,
7550
+ externalId: "IkYcYBUcyY2"
7551
+ },
7552
+ {
7553
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7554
+ name: "Mbondo",
7555
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7556
+ validUntil: null,
7557
+ externalId: "Qhvv5hvo3mY"
7558
+ },
7559
+ {
7560
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7561
+ name: "Ndara",
7562
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7563
+ validUntil: null,
7564
+ externalId: "crXh068O9TR"
7565
+ },
7566
+ {
7567
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7568
+ name: "Olani",
7569
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7570
+ validUntil: null,
7571
+ externalId: "r00It8Tvvp7"
7572
+ },
7573
+ {
7574
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7575
+ name: "Pemba",
7576
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7577
+ validUntil: null,
7578
+ externalId: "ZnUWsbONIaH"
7579
+ },
7580
+ {
7581
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7582
+ name: "Quanza",
7583
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7584
+ validUntil: null,
7585
+ externalId: "fDZycvQTa7l"
7586
+ },
7587
+ {
7588
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7589
+ name: "Rivka",
7590
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7591
+ validUntil: null,
7592
+ externalId: "KqswxCGTELa"
7593
+ },
7594
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
7595
+ {
7596
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7597
+ name: "Mbula",
7598
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7599
+ validUntil: null,
7600
+ externalId: "osEbKjRc9Kg"
7601
+ },
7602
+ {
7603
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7604
+ name: "Ndoki",
7605
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7606
+ validUntil: null,
7607
+ externalId: "aq4daBUAGr3"
7608
+ },
7609
+ {
7610
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7611
+ name: "Tsanga",
7612
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7613
+ validUntil: null,
7614
+ externalId: "cqis6Y8trbJ"
7615
+ },
7616
+ {
7617
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7618
+ name: "Waziri",
7619
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7620
+ validUntil: null,
7621
+ externalId: "LMijHPyyx6d"
7622
+ },
7623
+ {
7624
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7625
+ name: "Zimbi",
7626
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7627
+ validUntil: null,
7628
+ externalId: "pcQYbPuKGZ7"
7629
+ },
7630
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
7631
+ {
7632
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7633
+ name: "Felani",
7634
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7635
+ validUntil: null,
7636
+ externalId: "gSqpoCGdMXp"
7637
+ },
7638
+ {
7639
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7640
+ name: "Goroma",
7641
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7642
+ validUntil: null,
7643
+ externalId: "KvAAIaNqVrp"
7644
+ },
7645
+ {
7646
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7647
+ name: "Halifu",
7648
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7649
+ validUntil: null,
7650
+ externalId: "qe4UnEVt1hv"
7651
+ },
7652
+ {
7653
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7654
+ name: "Jabari",
7655
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7656
+ validUntil: null,
7657
+ externalId: "yHH9Nz4rLOt"
7658
+ },
7659
+ {
7660
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7661
+ name: "Kifani",
7662
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7663
+ validUntil: null,
7664
+ externalId: "eSWmXIGeu1I"
7665
+ },
7666
+ {
7667
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7668
+ name: "Lumela",
7669
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7670
+ validUntil: null,
7671
+ externalId: "bh0b3aI1uP3"
7672
+ }
7673
+ ];
7674
+ var V2_DEFAULT_MOCK_LOCATIONS = [
7675
+ {
7676
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7677
+ name: "Central Provincial Office",
7678
+ locationType: "CRVS_OFFICE",
7679
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7680
+ validUntil: null,
7681
+ externalId: "Xr3Df8WpK6Ys"
7682
+ },
7683
+ {
7684
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7685
+ name: "Central Health Post",
7686
+ locationType: "HEALTH_FACILITY",
7687
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7688
+ validUntil: null
7689
+ },
7690
+ {
7691
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7692
+ name: "Ibombo District Office",
7693
+ locationType: "CRVS_OFFICE",
7694
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7695
+ validUntil: null,
7696
+ externalId: "Sm4Nw7GrD2Vy"
7697
+ },
7698
+ {
7699
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
7700
+ name: "Isamba District Office",
7701
+ locationType: "CRVS_OFFICE",
7702
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7703
+ validUntil: null,
7704
+ externalId: "Vg1Bq5XeH9Lt"
7705
+ },
7706
+ {
7707
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
7708
+ name: "Isango District Office",
7709
+ locationType: "CRVS_OFFICE",
7710
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7711
+ validUntil: null,
7712
+ externalId: "Je7Lm2XqN9Vz"
7713
+ },
7714
+ {
7715
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
7716
+ name: "Sulaka Provincial Office",
7717
+ locationType: "CRVS_OFFICE",
7718
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7719
+ validUntil: null,
7720
+ externalId: "Ht2Wp9KcX5Qv"
7721
+ },
7722
+ {
7723
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
7724
+ name: "Ilanga District Office",
7725
+ locationType: "CRVS_OFFICE",
7726
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7727
+ validUntil: null,
7728
+ externalId: "Yp6Ds1WqN3Xz"
7729
+ },
7730
+ {
7731
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
7732
+ name: "Chamakubi Health Post",
7733
+ locationType: "HEALTH_FACILITY",
7734
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7735
+ validUntil: null,
7736
+ externalId: "M1nFr8LbC2Qy"
7737
+ },
7738
+ {
7739
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
7740
+ name: "Ibombo Rural Health Centre",
7741
+ locationType: "HEALTH_FACILITY",
7742
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7743
+ validUntil: null,
7744
+ externalId: "bT7pV6YrW0Xc"
7745
+ },
7746
+ {
7747
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
7748
+ name: "Chikobo Rural Health Centre",
7749
+ locationType: "HEALTH_FACILITY",
7750
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7751
+ validUntil: null,
7752
+ externalId: "zE4qPn2SgJ5d"
7753
+ },
7754
+ {
7755
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
7756
+ name: "Chilochabalenje Health Post",
7757
+ locationType: "HEALTH_FACILITY",
7758
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7759
+ validUntil: null,
7760
+ externalId: "H8vDs1MqR4Uf"
7761
+ },
7762
+ {
7763
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
7764
+ name: "Chipeso Rural Health Centre",
7765
+ locationType: "HEALTH_FACILITY",
7766
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7767
+ validUntil: null,
7768
+ externalId: "Qw3uZ9KfX6Lm"
7769
+ },
7770
+ {
7771
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
7772
+ name: "Chisamba Rural Health Centre",
7773
+ locationType: "HEALTH_FACILITY",
7774
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7775
+ validUntil: null,
7776
+ externalId: "Yr0pCg8LdM2s"
7777
+ },
7778
+ {
7779
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
7780
+ name: "Chitanda Rural Health Centre",
7781
+ locationType: "HEALTH_FACILITY",
7782
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7783
+ validUntil: null,
7784
+ externalId: "tS9gJ4PwB1Qx"
7785
+ },
7786
+ {
7787
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
7788
+ name: "Golden Valley Rural Health Centre",
7789
+ locationType: "HEALTH_FACILITY",
7790
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7791
+ validUntil: null,
7792
+ externalId: "Ld7Qm3XsA8Vr"
7793
+ },
7794
+ {
7795
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
7796
+ name: "Ipongo Rural Health Centre",
7797
+ locationType: "HEALTH_FACILITY",
7798
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7799
+ validUntil: null,
7800
+ externalId: "kF2sW9DmH0Bt"
7801
+ },
7802
+ {
7803
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
7804
+ name: "Itumbwe Health Post",
7805
+ locationType: "HEALTH_FACILITY",
7806
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7807
+ validUntil: null,
7808
+ externalId: "Ue5Xb3VaC7Pq"
7809
+ },
7810
+ {
7811
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
7812
+ name: "Kabangalala Rural Health Centre",
7813
+ locationType: "HEALTH_FACILITY",
7814
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7815
+ validUntil: null,
7816
+ externalId: "Pz8Kc1TqH6Jn"
7817
+ },
7818
+ // Village offices
7819
+ {
7820
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
7821
+ name: "Klow Village Office",
7822
+ locationType: "CRVS_OFFICE",
7823
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7824
+ validUntil: null,
7825
+ externalId: "PmAyxAJkxiJ"
7826
+ }
7827
+ ];
7828
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7829
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7830
+ );
7831
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7832
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7833
+ );
7834
+
6960
7835
  // ../commons/src/notification/UserNotifications.ts
6961
7836
  var z44 = __toESM(require("zod/v4"));
6962
7837
  var TriggerEvent = {