@opencrvs/toolkit 2.0.0 → 2.1.0-rc.00fa07b

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 (133) hide show
  1. package/README.md +16 -0
  2. package/build.sh +5 -4
  3. package/create-countryconfig/package.json +1 -1
  4. package/dist/application-config/index.js +32 -7
  5. package/dist/cli.js +3222 -4889
  6. package/dist/commons/api/router.d.ts +3561 -2890
  7. package/dist/commons/application-config/index.d.ts +6 -6
  8. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  9. package/dist/commons/events/ActionConfig.d.ts +302 -67
  10. package/dist/commons/events/ActionDocument.d.ts +155 -111
  11. package/dist/commons/events/ActionInput.d.ts +26 -6
  12. package/dist/commons/events/ActionType.d.ts +63 -58
  13. package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -489
  14. package/dist/commons/events/AuditLog.d.ts +79 -40
  15. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  16. package/dist/commons/events/Conditional.d.ts +3 -3
  17. package/dist/commons/events/CountryConfigQueryInput.d.ts +603 -561
  18. package/dist/commons/events/Draft.d.ts +37 -35
  19. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  20. package/dist/commons/events/EventConfig.d.ts +5 -3
  21. package/dist/commons/events/EventDocument.d.ts +66 -44
  22. package/dist/commons/events/EventIndex.d.ts +76 -51
  23. package/dist/commons/events/EventMetadata.d.ts +60 -34
  24. package/dist/commons/events/FieldConfig.d.ts +341 -321
  25. package/dist/commons/events/FieldType.d.ts +51 -51
  26. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  27. package/dist/commons/events/FieldValue.d.ts +12 -12
  28. package/dist/commons/events/Flag.d.ts +15 -15
  29. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  30. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  31. package/dist/commons/events/WorkqueueConfig.d.ts +840 -798
  32. package/dist/commons/events/deduplication.d.ts +1 -1
  33. package/dist/commons/events/event.d.ts +2 -2
  34. package/dist/commons/events/field.d.ts +69 -198
  35. package/dist/commons/events/index.d.ts +1 -0
  36. package/dist/commons/events/locationPayloads.d.ts +95 -0
  37. package/dist/commons/events/locations.d.ts +104 -6
  38. package/dist/commons/events/mocks.test.utils.d.ts +18 -4
  39. package/dist/commons/events/scopes.d.ts +5 -4
  40. package/dist/commons/events/state/index.d.ts +23 -15
  41. package/dist/commons/events/state/utils.d.ts +15 -6
  42. package/dist/commons/events/test.utils.d.ts +44 -39
  43. package/dist/commons/events/utils.d.ts +127 -105
  44. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  45. package/dist/conditionals/index.js +13 -5
  46. package/dist/environment/custom-types.d.ts +33 -0
  47. package/dist/environment/custom-types.d.ts.map +1 -0
  48. package/dist/environment/custom-types.js +12 -0
  49. package/dist/environment/derived-variables.d.ts +122 -0
  50. package/dist/environment/derived-variables.d.ts.map +1 -0
  51. package/dist/environment/derived-variables.js +155 -0
  52. package/dist/environment/editor-questions.d.ts +4 -0
  53. package/dist/environment/editor-questions.d.ts.map +1 -0
  54. package/dist/environment/editor-questions.js +67 -0
  55. package/dist/environment/git.d.ts +5 -0
  56. package/dist/environment/git.d.ts.map +1 -0
  57. package/dist/environment/git.js +38 -0
  58. package/dist/environment/github.d.ts +26 -0
  59. package/dist/environment/github.d.ts.map +1 -0
  60. package/dist/environment/github.js +247 -0
  61. package/dist/environment/index.d.ts +6 -0
  62. package/dist/environment/index.d.ts.map +1 -0
  63. package/dist/environment/index.js +81 -0
  64. package/dist/environment/logger.d.ts +6 -0
  65. package/dist/environment/logger.d.ts.map +1 -0
  66. package/dist/environment/logger.js +25 -0
  67. package/dist/environment/manage-users.d.ts +11 -0
  68. package/dist/environment/manage-users.d.ts.map +1 -0
  69. package/dist/environment/manage-users.js +507 -0
  70. package/dist/environment/paths.d.ts +7 -0
  71. package/dist/environment/paths.d.ts.map +1 -0
  72. package/dist/environment/paths.js +72 -0
  73. package/dist/environment/questions-helper.d.ts +15 -0
  74. package/dist/environment/questions-helper.d.ts.map +1 -0
  75. package/dist/environment/questions-helper.js +70 -0
  76. package/dist/environment/questions.d.ts +200 -0
  77. package/dist/environment/questions.d.ts.map +1 -0
  78. package/dist/environment/questions.js +412 -0
  79. package/dist/environment/setup-environment.d.ts +2 -0
  80. package/dist/environment/setup-environment.d.ts.map +1 -0
  81. package/dist/environment/setup-environment.js +775 -0
  82. package/dist/environment/ssh-keygen.d.ts +5 -0
  83. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  84. package/dist/environment/ssh-keygen.js +21 -0
  85. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  86. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  87. package/dist/environment/swarm-to-k8s.js +183 -0
  88. package/dist/environment/templates.d.ts +27 -0
  89. package/dist/environment/templates.d.ts.map +1 -0
  90. package/dist/environment/templates.js +164 -0
  91. package/dist/environment/update-workflows.d.ts +2 -0
  92. package/dist/environment/update-workflows.d.ts.map +1 -0
  93. package/dist/environment/update-workflows.js +191 -0
  94. package/dist/environment/upgrade.d.ts +2 -0
  95. package/dist/environment/upgrade.d.ts.map +1 -0
  96. package/dist/environment/upgrade.js +82 -0
  97. package/dist/environment/users.d.ts +2 -0
  98. package/dist/environment/users.d.ts.map +1 -0
  99. package/dist/environment/users.js +120 -0
  100. package/dist/environment/utils.d.ts +18 -0
  101. package/dist/environment/utils.d.ts.map +1 -0
  102. package/dist/environment/utils.js +110 -0
  103. package/dist/events/deduplication.d.ts +1 -1
  104. package/dist/events/index.js +422 -97
  105. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  106. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  107. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  108. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  109. package/dist/migrations/v2.0/index.js +88 -5139
  110. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  111. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  112. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  113. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  114. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  115. package/dist/migrations/v2.1/index.d.ts +6 -0
  116. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  117. package/dist/migrations/v2.1/index.js +218 -0
  118. package/dist/notification/index.js +344 -110
  119. package/dist/scopes/index.d.ts +213 -117
  120. package/dist/scopes/index.js +13 -5
  121. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  122. package/dist/templates/charts-values/dependencies/values.yaml +80 -0
  123. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  124. package/dist/templates/charts-values/opencrvs-services/values.yaml +77 -0
  125. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  126. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  127. package/dist/templates/inventory/inventory.template.yml +100 -0
  128. package/dist/templates/inventory/production.example.yml +77 -0
  129. package/dist/templates/inventory/qa.example.yml +48 -0
  130. package/opencrvs-toolkit-2.1.0-rc.00fa07b.tgz +0 -0
  131. package/package.json +18 -4
  132. package/tsconfig.tsbuildinfo +1 -1
  133. package/opencrvs-toolkit-2.0.0.tgz +0 -0
@@ -38,7 +38,7 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z45 = __toESM(require("zod/v4"));
41
+ var z46 = __toESM(require("zod/v4"));
42
42
 
43
43
  // ../commons/src/url.ts
44
44
  function joinUrl(base, path) {
@@ -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",
@@ -95,6 +96,7 @@ var PlainScopeType = z2.enum([
95
96
  "integration.create",
96
97
  "record.import",
97
98
  "config.update-all",
99
+ "location.edit",
98
100
  "attachment.upload",
99
101
  "profile.electronic-signature",
100
102
  "user.read-only-my-audit",
@@ -118,11 +120,13 @@ var scopeOptionsPlaceEvent = z2.object({
118
120
  event: scopeByEvent,
119
121
  placeOfEvent: JurisdictionFilter.optional()
120
122
  }).describe("Options applicable to all record scopes.");
121
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
123
+ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
124
+ notifiedIn: JurisdictionFilter.optional(),
125
+ notifiedBy: UserFilter.optional(),
122
126
  declaredIn: JurisdictionFilter.optional(),
123
127
  declaredBy: UserFilter.optional()
124
128
  }).describe("Options applicable to actions that may take place after DECLARE");
125
- var AllRecordScopeOptions = scopeOptionsDeclared.extend({
129
+ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
126
130
  registeredIn: JurisdictionFilter.optional(),
127
131
  registeredBy: UserFilter.optional()
128
132
  }).describe(
@@ -160,6 +164,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
160
164
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
161
165
  );
162
166
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
167
+ notifiedIn: UUID.nullish(),
168
+ notifiedBy: z2.string().optional(),
163
169
  declaredIn: UUID.nullish(),
164
170
  declaredBy: z2.string().optional()
165
171
  }).describe(
@@ -180,6 +186,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
180
186
  "record.edit",
181
187
  "record.reject",
182
188
  "record.archive",
189
+ "record.unarchive",
183
190
  "record.review-duplicates",
184
191
  "record.register"
185
192
  ]);
@@ -205,7 +212,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
205
212
  }),
206
213
  z2.object({
207
214
  type: ScopesWithDeclaredOptions,
208
- options: scopeOptionsDeclared.optional()
215
+ options: scopeOptionsDeclaredOrNotified.optional()
209
216
  }),
210
217
  z2.object({
211
218
  type: ScopesWithFullOptions,
@@ -294,8 +301,9 @@ var EncodedScope = z2.string().brand("EncodedScope");
294
301
  var DEFAULT_SCOPE_OPTIONS = {
295
302
  placeOfEvent: JurisdictionFilter.enum.all,
296
303
  accessLevel: JurisdictionFilter.enum.all,
297
- registeredIn: JurisdictionFilter.enum.all,
298
- declaredIn: JurisdictionFilter.enum.all
304
+ notifiedIn: JurisdictionFilter.enum.all,
305
+ declaredIn: JurisdictionFilter.enum.all,
306
+ registeredIn: JurisdictionFilter.enum.all
299
307
  };
300
308
 
301
309
  // ../commons/src/authentication.ts
@@ -320,6 +328,7 @@ var ActionType = {
320
328
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
321
329
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
322
330
  ARCHIVE: "ARCHIVE",
331
+ UNARCHIVE: "UNARCHIVE",
323
332
  // Record actions
324
333
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
325
334
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -339,6 +348,7 @@ var ConfirmableActions = [
339
348
  ActionType.REGISTER,
340
349
  ActionType.REJECT,
341
350
  ActionType.ARCHIVE,
351
+ ActionType.UNARCHIVE,
342
352
  ActionType.PRINT_CERTIFICATE,
343
353
  ActionType.REQUEST_CORRECTION,
344
354
  ActionType.APPROVE_CORRECTION,
@@ -357,6 +367,7 @@ var ActionTypes = z4.enum([
357
367
  "MARK_AS_DUPLICATE",
358
368
  "MARK_AS_NOT_DUPLICATE",
359
369
  "ARCHIVE",
370
+ "UNARCHIVE",
360
371
  "PRINT_CERTIFICATE",
361
372
  "REQUEST_CORRECTION",
362
373
  "REJECT_CORRECTION",
@@ -400,6 +411,7 @@ var WorkqueueActionType = ActionTypes.extract([
400
411
  ActionType.REJECT,
401
412
  ActionType.MARK_AS_DUPLICATE,
402
413
  ActionType.ARCHIVE,
414
+ ActionType.UNARCHIVE,
403
415
  ActionType.PRINT_CERTIFICATE,
404
416
  ActionType.REQUEST_CORRECTION
405
417
  ]);
@@ -461,6 +473,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
461
473
  "event.actions.unassign.request",
462
474
  "event.actions.read.request",
463
475
  "event.actions.archive.request",
476
+ "event.actions.unarchive.request",
464
477
  "event.actions.reinstate.request",
465
478
  "event.actions.print_certificate.request",
466
479
  "event.actions.correction.request.request",
@@ -518,6 +531,29 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
518
531
  requestData: z5.object({ id: z5.string() }),
519
532
  responseSummary: z5.object({ clientId: z5.string() })
520
533
  });
534
+ var createdVersionFields = {
535
+ id: z5.string(),
536
+ versionId: z5.string(),
537
+ name: z5.string(),
538
+ externalId: z5.string().nullish(),
539
+ effectiveFrom: z5.string(),
540
+ status: z5.string()
541
+ };
542
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
543
+ operation: z5.literal("locations.create"),
544
+ requestData: z5.object({
545
+ ...createdVersionFields,
546
+ administrativeAreaId: z5.string().nullish(),
547
+ locationType: z5.string().nullish()
548
+ })
549
+ });
550
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
551
+ operation: z5.literal("administrativeAreas.create"),
552
+ requestData: z5.object({
553
+ ...createdVersionFields,
554
+ parentId: z5.string().nullish()
555
+ })
556
+ });
521
557
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
522
558
  operation: z5.literal("attachments.upload"),
523
559
  requestData: z5.object({
@@ -593,6 +629,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
593
629
  IntegrationActivateEntrySchema,
594
630
  IntegrationDeleteEntrySchema,
595
631
  IntegrationRefreshSecretEntrySchema,
632
+ LocationCreateEntrySchema,
633
+ AdministrativeAreaCreateEntrySchema,
596
634
  AttachmentUploadEntrySchema,
597
635
  UserCreateEntrySchema,
598
636
  UserReasonEntrySchema,
@@ -1186,6 +1224,11 @@ var ArchiveAction = ActionBase.extend(
1186
1224
  content: ReasonContent
1187
1225
  }).shape
1188
1226
  );
1227
+ var UnarchiveAction = ActionBase.extend(
1228
+ z14.object({
1229
+ type: z14.literal(ActionType.UNARCHIVE)
1230
+ }).shape
1231
+ );
1189
1232
  var CreatedAction = ActionBase.extend(
1190
1233
  z14.object({
1191
1234
  type: z14.literal(ActionType.CREATE)
@@ -1199,9 +1242,10 @@ var NotifiedAction = ActionBase.extend(
1199
1242
  var EditAction = ActionBase.extend(
1200
1243
  z14.object({
1201
1244
  type: z14.literal(ActionType.EDIT),
1245
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1202
1246
  content: z14.object({
1203
1247
  comment: z14.string().describe("Comment for the edit action.").optional()
1204
- })
1248
+ }).optional()
1205
1249
  }).shape
1206
1250
  );
1207
1251
  var PrintContent = z14.object({
@@ -1252,6 +1296,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1252
1296
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1253
1297
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1254
1298
  ArchiveAction.meta({ id: "ArchiveAction" }),
1299
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1255
1300
  NotifiedAction.meta({ id: "NotifiedAction" }),
1256
1301
  RegisterAction.meta({ id: "RegisterAction" }),
1257
1302
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1357,6 +1402,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1357
1402
  )
1358
1403
  });
1359
1404
  var LegalStatuses = z16.object({
1405
+ [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1360
1406
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1361
1407
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1362
1408
  });
@@ -1416,6 +1462,8 @@ var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
1416
1462
  var EventMetadataDateFieldIdInput = z16.enum([
1417
1463
  "createdAt",
1418
1464
  "updatedAt",
1465
+ "legalStatuses.NOTIFIED.createdAt",
1466
+ "legalStatuses.NOTIFIED.acceptedAt",
1419
1467
  "legalStatuses.DECLARED.createdAt",
1420
1468
  "legalStatuses.DECLARED.acceptedAt",
1421
1469
  "legalStatuses.REGISTERED.createdAt",
@@ -1424,6 +1472,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
1424
1472
  var EventMetadataDateFieldId = z16.enum([
1425
1473
  "event.createdAt",
1426
1474
  "event.updatedAt",
1475
+ "event.legalStatuses.NOTIFIED.createdAt",
1476
+ "event.legalStatuses.NOTIFIED.acceptedAt",
1427
1477
  "event.legalStatuses.DECLARED.createdAt",
1428
1478
  "event.legalStatuses.DECLARED.acceptedAt",
1429
1479
  "event.legalStatuses.REGISTERED.createdAt",
@@ -1483,7 +1533,8 @@ var Range = import_v4.z.object({
1483
1533
  });
1484
1534
  var ContainsFlags = import_v4.z.object({
1485
1535
  anyOf: import_v4.z.array(Flag).optional(),
1486
- noneOf: import_v4.z.array(Flag).optional()
1536
+ noneOf: import_v4.z.array(Flag).optional(),
1537
+ allOf: import_v4.z.array(Flag).optional()
1487
1538
  }).meta({
1488
1539
  id: "ContainsFlags"
1489
1540
  });
@@ -2670,6 +2721,9 @@ var ActionConfigBase = z24.object({
2670
2721
  var DeclarationActionBase = ActionConfigBase.extend({
2671
2722
  deduplication: DeduplicationConfig.optional()
2672
2723
  });
2724
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2725
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2726
+ );
2673
2727
  var ReadActionConfig = ActionConfigBase.extend(
2674
2728
  z24.object({
2675
2729
  type: z24.literal(ActionType.READ),
@@ -2679,12 +2733,65 @@ var ReadActionConfig = ActionConfigBase.extend(
2679
2733
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2680
2734
  }).shape
2681
2735
  );
2736
+ var NotifyConfig = ActionConfigBase.extend(
2737
+ z24.object({
2738
+ type: z24.literal(ActionType.NOTIFY),
2739
+ form: actionConfirmationForm
2740
+ }).shape
2741
+ );
2742
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
2743
+ z24.object({
2744
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2745
+ label: z24.never().optional().describe(
2746
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2747
+ ),
2748
+ supportingCopy: z24.never().optional(),
2749
+ icon: z24.never().optional().describe(
2750
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2751
+ ),
2752
+ conditionals: z24.never().optional().describe(
2753
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2754
+ )
2755
+ }).shape
2756
+ );
2757
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2758
+ z24.object({
2759
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2760
+ }).shape
2761
+ );
2762
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2763
+ z24.object({
2764
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2765
+ }).shape
2766
+ );
2767
+ var AssignConfig = ActionConfigBase.extend(
2768
+ z24.object({
2769
+ type: z24.literal(ActionType.ASSIGN),
2770
+ flags: z24.never().optional().describe(
2771
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2772
+ )
2773
+ }).shape
2774
+ );
2775
+ var UnassignConfig = ActionConfigBase.extend(
2776
+ z24.object({
2777
+ type: z24.literal(ActionType.UNASSIGN),
2778
+ flags: z24.never().optional().describe(
2779
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2780
+ )
2781
+ }).shape
2782
+ );
2783
+ var DeleteConfig = ActionConfigBase.extend(
2784
+ z24.object({
2785
+ type: z24.literal(ActionType.DELETE)
2786
+ }).shape
2787
+ );
2682
2788
  var DeclareConfig = DeclarationActionBase.extend(
2683
2789
  z24.object({
2684
2790
  type: z24.literal(ActionType.DECLARE),
2685
2791
  review: DeclarationReviewConfig.describe(
2686
2792
  "Configuration of the review page fields."
2687
2793
  ),
2794
+ form: actionConfirmationForm,
2688
2795
  dialogCopy: z24.object({
2689
2796
  notify: TranslationConfig.describe(
2690
2797
  "Confirmation text for the notify action"
@@ -2700,7 +2807,13 @@ var DeclareConfig = DeclarationActionBase.extend(
2700
2807
  );
2701
2808
  var ArchiveConfig = ActionConfigBase.extend(
2702
2809
  z24.object({
2703
- type: z24.literal(ActionType.ARCHIVE)
2810
+ type: z24.literal(ActionType.ARCHIVE),
2811
+ form: actionConfirmationForm
2812
+ }).shape
2813
+ );
2814
+ var UnarchiveConfig = ActionConfigBase.extend(
2815
+ z24.object({
2816
+ type: z24.literal(ActionType.UNARCHIVE)
2704
2817
  }).shape
2705
2818
  );
2706
2819
  var EditActionConfig = ActionConfigBase.extend(
@@ -2721,12 +2834,14 @@ var EditActionConfig = ActionConfigBase.extend(
2721
2834
  );
2722
2835
  var RejectConfig = ActionConfigBase.extend(
2723
2836
  z24.object({
2724
- type: z24.literal(ActionType.REJECT)
2837
+ type: z24.literal(ActionType.REJECT),
2838
+ form: actionConfirmationForm
2725
2839
  }).shape
2726
2840
  );
2727
2841
  var RegisterConfig = DeclarationActionBase.extend(
2728
2842
  z24.object({
2729
- type: z24.literal(ActionType.REGISTER)
2843
+ type: z24.literal(ActionType.REGISTER),
2844
+ form: actionConfirmationForm
2730
2845
  }).shape
2731
2846
  );
2732
2847
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -2741,7 +2856,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2741
2856
  correctionForm: ActionFormConfig
2742
2857
  }).shape
2743
2858
  );
2744
- var CustomActionConfig = ActionConfigBase.merge(
2859
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2860
+ z24.object({
2861
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2862
+ }).shape
2863
+ );
2864
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2865
+ z24.object({
2866
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2867
+ }).shape
2868
+ );
2869
+ var CustomActionConfig = ActionConfigBase.extend(
2745
2870
  z24.object({
2746
2871
  type: z24.literal(ActionType.CUSTOM),
2747
2872
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2752,7 +2877,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2752
2877
  auditHistoryLabel: TranslationConfig.describe(
2753
2878
  'The label to show in audit history for this action. For example "Approved".'
2754
2879
  )
2755
- })
2880
+ }).shape
2756
2881
  );
2757
2882
  var ActionConfig = z24.discriminatedUnion("type", [
2758
2883
  /*
@@ -2763,9 +2888,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
2763
2888
  id: "ReadActionConfig",
2764
2889
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2765
2890
  }),
2891
+ AssignConfig.meta({
2892
+ id: "AssignActionConfig",
2893
+ description: "Configuration for assigning a record to the current user."
2894
+ }),
2895
+ UnassignConfig.meta({
2896
+ id: "UnassignActionConfig",
2897
+ description: "Configuration for unassigning a record from its current assignee."
2898
+ }),
2899
+ DeleteConfig.meta({
2900
+ id: "DeleteActionConfig",
2901
+ description: "Configuration for deleting a draft record."
2902
+ }),
2903
+ NotifyConfig.meta({
2904
+ id: "NotifyActionConfig",
2905
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2906
+ }),
2766
2907
  DeclareConfig.meta({
2767
2908
  id: "DeclareActionConfig",
2768
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2909
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2910
+ }),
2911
+ DuplicateDetectedConfig.meta({
2912
+ id: "DuplicateDetectedActionConfig",
2913
+ 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."
2914
+ }),
2915
+ MarkAsDuplicateConfig.meta({
2916
+ id: "MarkAsDuplicateActionConfig",
2917
+ description: "Configuration for marking a record as a duplicate."
2918
+ }),
2919
+ MarkAsNotDuplicateConfig.meta({
2920
+ id: "MarkAsNotDuplicateActionConfig",
2921
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2769
2922
  }),
2770
2923
  RejectConfig.meta({
2771
2924
  id: "RejectActionConfig",
@@ -2783,6 +2936,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2783
2936
  id: "RequestCorrectionActionConfig",
2784
2937
  description: "Configuration for requesting a correction on a registered record."
2785
2938
  }),
2939
+ ApproveCorrectionConfig.meta({
2940
+ id: "ApproveCorrectionActionConfig",
2941
+ description: "Configuration for approving a requested correction."
2942
+ }),
2943
+ RejectCorrectionConfig.meta({
2944
+ id: "RejectCorrectionActionConfig",
2945
+ description: "Configuration for rejecting a requested correction."
2946
+ }),
2786
2947
  EditActionConfig.meta({
2787
2948
  id: "EditActionConfig",
2788
2949
  description: "Configuration for editing a record before registration."
@@ -2791,6 +2952,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
2791
2952
  id: "ArchiveActionConfig",
2792
2953
  description: "Configuration for archiving a record."
2793
2954
  }),
2955
+ UnarchiveConfig.meta({
2956
+ id: "UnarchiveActionConfig",
2957
+ description: "Configuration for unarchiving a record."
2958
+ }),
2794
2959
  CustomActionConfig.meta({
2795
2960
  id: "CustomActionConfig",
2796
2961
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3196,13 +3361,9 @@ var getActionAnnotationFields = (actionConfig) => {
3196
3361
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3197
3362
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3198
3363
  }
3199
- if (actionConfig.type === ActionType.CUSTOM) {
3200
- return actionConfig.form;
3201
- }
3202
- if ("review" in actionConfig) {
3203
- return actionConfig.review.fields;
3204
- }
3205
- return [];
3364
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3365
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3366
+ return [...reviewFields, ...formFields];
3206
3367
  };
3207
3368
  function getAllAnnotationFields(config) {
3208
3369
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -3910,7 +4071,7 @@ function validateActionFlags(event2, ctx) {
3910
4071
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3911
4072
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3912
4073
  const actionFlagIds = event2.actions.flatMap(
3913
- (action) => action.flags.map((flag) => flag.id)
4074
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3914
4075
  );
3915
4076
  for (const actionFlagId of actionFlagIds) {
3916
4077
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -4518,10 +4679,7 @@ var DeclareActionInput = BaseActionInput.extend(
4518
4679
  );
4519
4680
  var EditActionInput = BaseActionInput.extend(
4520
4681
  z38.object({
4521
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
4522
- content: z38.object({
4523
- comment: z38.string().describe("Comment for the edit action.").optional()
4524
- })
4682
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
4525
4683
  }).shape
4526
4684
  );
4527
4685
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -4563,6 +4721,11 @@ var ArchiveActionInput = BaseActionInput.extend(
4563
4721
  content: ReasonContent
4564
4722
  }).shape
4565
4723
  );
4724
+ var UnarchiveActionInput = BaseActionInput.extend(
4725
+ z38.object({
4726
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4727
+ }).shape
4728
+ );
4566
4729
  var AssignActionInput = BaseActionInput.extend(
4567
4730
  z38.object({
4568
4731
  type: z38.literal(ActionType.ASSIGN),
@@ -4624,6 +4787,7 @@ var ActionInput = z38.discriminatedUnion("type", [
4624
4787
  id: "MarkNotDuplicateActionInput"
4625
4788
  }),
4626
4789
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4790
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
4627
4791
  AssignActionInput.meta({ id: "AssignActionInput" }),
4628
4792
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
4629
4793
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -4701,6 +4865,7 @@ var updateActions = ActionTypes.extract([
4701
4865
  ActionType.REGISTER,
4702
4866
  ActionType.REJECT,
4703
4867
  ActionType.ARCHIVE,
4868
+ ActionType.UNARCHIVE,
4704
4869
  ActionType.PRINT_CERTIFICATE,
4705
4870
  ActionType.REQUEST_CORRECTION,
4706
4871
  ActionType.APPROVE_CORRECTION,
@@ -4719,15 +4884,12 @@ var INHERENT_FLAG_RULES = [
4719
4884
  },
4720
4885
  {
4721
4886
  // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4722
- // other status-changing action (see getStatusFromActions).
4887
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
4888
+ // are deliberately excluded so the flag freezes across an archive/unarchive
4889
+ // round trip and comes back exactly as it was.
4723
4890
  flag: InherentFlags.INCOMPLETE,
4724
4891
  setOn: [ActionType.NOTIFY],
4725
- resetOn: [
4726
- ActionType.CREATE,
4727
- ActionType.DECLARE,
4728
- ActionType.REGISTER,
4729
- ActionType.ARCHIVE
4730
- ]
4892
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4731
4893
  },
4732
4894
  {
4733
4895
  flag: InherentFlags.REJECTED,
@@ -6056,6 +6218,20 @@ var tennisClubMembershipEvent = defineConfig({
6056
6218
  },
6057
6219
  review: TENNIS_CLUB_DECLARATION_REVIEW
6058
6220
  },
6221
+ {
6222
+ type: ActionType.NOTIFY,
6223
+ label: {
6224
+ defaultMessage: "Notify health worker",
6225
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6226
+ id: "event.tennis-club-membership.action.notify.label"
6227
+ },
6228
+ flags: [
6229
+ {
6230
+ id: "health-worker-notified",
6231
+ operation: "add"
6232
+ }
6233
+ ]
6234
+ },
6059
6235
  {
6060
6236
  type: ActionType.REJECT,
6061
6237
  label: {
@@ -6298,6 +6474,17 @@ var tennisClubMembershipEvent = defineConfig({
6298
6474
  }
6299
6475
  }
6300
6476
  ],
6477
+ flags: [
6478
+ {
6479
+ id: "health-worker-notified",
6480
+ requiresAction: false,
6481
+ label: {
6482
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6483
+ defaultMessage: "Health worker notified",
6484
+ description: "Label for the health-worker-notified flag"
6485
+ }
6486
+ }
6487
+ ],
6301
6488
  advancedSearch: [
6302
6489
  {
6303
6490
  title: {
@@ -7198,21 +7385,44 @@ var LocationTypeV1 = z43.enum([
7198
7385
  "CRVS_OFFICE",
7199
7386
  "HEALTH_FACILITY"
7200
7387
  ]);
7388
+ var LocationStatus = z43.enum(["active", "inactive"]);
7389
+ var LocationVersion = z43.object({
7390
+ versionId: UUID,
7391
+ effectiveFrom: z43.iso.date(),
7392
+ name: z43.string(),
7393
+ externalId: z43.string().nullish(),
7394
+ status: LocationStatus
7395
+ });
7201
7396
  var AdministrativeArea = z43.object({
7202
7397
  id: UUID,
7203
7398
  name: z43.string(),
7204
7399
  externalId: z43.string().nullish(),
7205
7400
  parentId: UUID.nullable(),
7206
- validUntil: z43.iso.datetime().nullable()
7401
+ status: LocationStatus,
7402
+ versions: z43.array(LocationVersion)
7207
7403
  });
7208
7404
  var Location = z43.object({
7209
7405
  id: UUID,
7210
7406
  name: z43.string(),
7211
7407
  externalId: z43.string().nullish(),
7212
7408
  administrativeAreaId: UUID.nullable(),
7213
- validUntil: z43.iso.datetime().nullable(),
7409
+ locationType: z43.string().nullable(),
7410
+ status: LocationStatus,
7411
+ versions: z43.array(LocationVersion)
7412
+ });
7413
+ var SetLocationPayload = z43.object({
7414
+ id: UUID,
7415
+ name: z43.string(),
7416
+ externalId: z43.string().nullish(),
7417
+ administrativeAreaId: UUID.nullable(),
7214
7418
  locationType: z43.string().nullable()
7215
7419
  });
7420
+ var SetAdministrativeAreaPayload = z43.object({
7421
+ id: UUID,
7422
+ name: z43.string(),
7423
+ externalId: z43.string().nullish(),
7424
+ parentId: UUID.nullable()
7425
+ });
7216
7426
 
7217
7427
  // ../commons/src/events/scopes.ts
7218
7428
  var ACTION_SCOPE_MAP = {
@@ -7234,6 +7444,7 @@ var ACTION_SCOPE_MAP = {
7234
7444
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
7235
7445
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
7236
7446
  [ActionType.ARCHIVE]: ["record.archive"],
7447
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
7237
7448
  [ActionType.REJECT]: ["record.reject"],
7238
7449
  [ActionType.ASSIGN]: null,
7239
7450
  [ActionType.UNASSIGN]: null,
@@ -7276,7 +7487,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7276
7487
  ActionType.CUSTOM,
7277
7488
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
7278
7489
  ],
7279
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
7490
+ [EventStatus.enum.ARCHIVED]: [
7491
+ ActionType.READ,
7492
+ ActionType.CUSTOM,
7493
+ ActionType.UNARCHIVE
7494
+ ]
7280
7495
  };
7281
7496
  var ACTION_FILTERS = {
7282
7497
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
@@ -7289,6 +7504,7 @@ var ACTION_FILTERS = {
7289
7504
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7290
7505
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
7291
7506
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7507
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7292
7508
  [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7293
7509
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7294
7510
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
@@ -7305,75 +7521,80 @@ var REJECTED_ACTIONS = [
7305
7521
  var import_lodash7 = require("lodash");
7306
7522
 
7307
7523
  // ../commons/src/events/mocks.test.utils.ts
7308
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7524
+ function withVersionFields(entity) {
7525
+ return {
7526
+ ...entity,
7527
+ status: "active",
7528
+ versions: [
7529
+ {
7530
+ versionId: entity.id,
7531
+ effectiveFrom: "0001-01-01",
7532
+ name: entity.name,
7533
+ externalId: entity.externalId ?? null,
7534
+ status: "active"
7535
+ }
7536
+ ]
7537
+ };
7538
+ }
7539
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
7309
7540
  {
7310
7541
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7311
7542
  name: "Central",
7312
7543
  parentId: null,
7313
- validUntil: null,
7314
7544
  externalId: "ydyJb1RAy4U1"
7315
7545
  },
7316
7546
  {
7317
7547
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7318
7548
  name: "Sulaka",
7319
7549
  parentId: null,
7320
- validUntil: null,
7321
7550
  externalId: "pQ8nGxWmZ2Q3"
7322
7551
  },
7323
7552
  {
7324
7553
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7325
7554
  name: "Pualula",
7326
7555
  parentId: null,
7327
- validUntil: null,
7328
7556
  externalId: "Aq91DweLmT8k"
7329
7557
  },
7330
7558
  {
7331
7559
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7332
7560
  name: "Chuminga",
7333
7561
  parentId: null,
7334
- validUntil: null,
7335
7562
  externalId: "Rw0fYNh2Xk9a"
7336
7563
  },
7337
7564
  {
7338
7565
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7339
7566
  name: "Ibombo",
7340
7567
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7341
- validUntil: null,
7342
7568
  externalId: "k7DsP4vbN1Qe"
7343
7569
  },
7344
7570
  {
7345
7571
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
7346
7572
  name: "Isango",
7347
7573
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7348
- validUntil: null,
7349
7574
  externalId: "Gm3Z9eQpHw4L"
7350
7575
  },
7351
7576
  {
7352
7577
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7353
7578
  name: "Isamba",
7354
7579
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7355
- validUntil: null,
7356
7580
  externalId: "sT0xVu1KqJ7r"
7357
7581
  },
7358
7582
  {
7359
7583
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7360
7584
  name: "Itambo",
7361
7585
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7362
- validUntil: null,
7363
7586
  externalId: "Nq6Bv2HpL9Te"
7364
7587
  },
7365
7588
  {
7366
7589
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7367
7590
  name: "Ezhi",
7368
7591
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7369
- validUntil: null,
7370
7592
  externalId: "xK8cQ0ZRy5Wd"
7371
7593
  },
7372
7594
  {
7373
7595
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7374
7596
  name: "Ilanga",
7375
7597
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7376
- validUntil: null,
7377
7598
  externalId: "Cq4Jm1XvN8Ls"
7378
7599
  },
7379
7600
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -7381,49 +7602,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7381
7602
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7382
7603
  name: "Klow",
7383
7604
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7384
- validUntil: null,
7385
7605
  externalId: "IkYcYBUcyY2"
7386
7606
  },
7387
7607
  {
7388
7608
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7389
7609
  name: "Mbondo",
7390
7610
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7391
- validUntil: null,
7392
7611
  externalId: "Qhvv5hvo3mY"
7393
7612
  },
7394
7613
  {
7395
7614
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7396
7615
  name: "Ndara",
7397
7616
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7398
- validUntil: null,
7399
7617
  externalId: "crXh068O9TR"
7400
7618
  },
7401
7619
  {
7402
7620
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7403
7621
  name: "Olani",
7404
7622
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7405
- validUntil: null,
7406
7623
  externalId: "r00It8Tvvp7"
7407
7624
  },
7408
7625
  {
7409
7626
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7410
7627
  name: "Pemba",
7411
7628
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7412
- validUntil: null,
7413
7629
  externalId: "ZnUWsbONIaH"
7414
7630
  },
7415
7631
  {
7416
7632
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7417
7633
  name: "Quanza",
7418
7634
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7419
- validUntil: null,
7420
7635
  externalId: "fDZycvQTa7l"
7421
7636
  },
7422
7637
  {
7423
7638
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7424
7639
  name: "Rivka",
7425
7640
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7426
- validUntil: null,
7427
7641
  externalId: "KqswxCGTELa"
7428
7642
  },
7429
7643
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -7431,35 +7645,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7431
7645
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7432
7646
  name: "Mbula",
7433
7647
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7434
- validUntil: null,
7435
7648
  externalId: "osEbKjRc9Kg"
7436
7649
  },
7437
7650
  {
7438
7651
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7439
7652
  name: "Ndoki",
7440
7653
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7441
- validUntil: null,
7442
7654
  externalId: "aq4daBUAGr3"
7443
7655
  },
7444
7656
  {
7445
7657
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7446
7658
  name: "Tsanga",
7447
7659
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7448
- validUntil: null,
7449
7660
  externalId: "cqis6Y8trbJ"
7450
7661
  },
7451
7662
  {
7452
7663
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7453
7664
  name: "Waziri",
7454
7665
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7455
- validUntil: null,
7456
7666
  externalId: "LMijHPyyx6d"
7457
7667
  },
7458
7668
  {
7459
7669
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7460
7670
  name: "Zimbi",
7461
7671
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7462
- validUntil: null,
7463
7672
  externalId: "pcQYbPuKGZ7"
7464
7673
  },
7465
7674
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -7467,67 +7676,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7467
7676
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7468
7677
  name: "Felani",
7469
7678
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7470
- validUntil: null,
7471
7679
  externalId: "gSqpoCGdMXp"
7472
7680
  },
7473
7681
  {
7474
7682
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7475
7683
  name: "Goroma",
7476
7684
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7477
- validUntil: null,
7478
7685
  externalId: "KvAAIaNqVrp"
7479
7686
  },
7480
7687
  {
7481
7688
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7482
7689
  name: "Halifu",
7483
7690
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7484
- validUntil: null,
7485
7691
  externalId: "qe4UnEVt1hv"
7486
7692
  },
7487
7693
  {
7488
7694
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7489
7695
  name: "Jabari",
7490
7696
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7491
- validUntil: null,
7492
7697
  externalId: "yHH9Nz4rLOt"
7493
7698
  },
7494
7699
  {
7495
7700
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7496
7701
  name: "Kifani",
7497
7702
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7498
- validUntil: null,
7499
7703
  externalId: "eSWmXIGeu1I"
7500
7704
  },
7501
7705
  {
7502
7706
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7503
7707
  name: "Lumela",
7504
7708
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7505
- validUntil: null,
7506
7709
  externalId: "bh0b3aI1uP3"
7507
7710
  }
7508
7711
  ];
7509
- var V2_DEFAULT_MOCK_LOCATIONS = [
7712
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
7713
+ var MOCK_LOCATIONS_BASE = [
7510
7714
  {
7511
7715
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7512
7716
  name: "Central Provincial Office",
7513
7717
  locationType: "CRVS_OFFICE",
7514
7718
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7515
- validUntil: null,
7516
7719
  externalId: "Xr3Df8WpK6Ys"
7517
7720
  },
7518
7721
  {
7519
7722
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7520
7723
  name: "Central Health Post",
7521
7724
  locationType: "HEALTH_FACILITY",
7522
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7523
- validUntil: null
7725
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
7524
7726
  },
7525
7727
  {
7526
7728
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7527
7729
  name: "Ibombo District Office",
7528
7730
  locationType: "CRVS_OFFICE",
7529
7731
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7530
- validUntil: null,
7531
7732
  externalId: "Sm4Nw7GrD2Vy"
7532
7733
  },
7533
7734
  {
@@ -7535,7 +7736,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7535
7736
  name: "Isamba District Office",
7536
7737
  locationType: "CRVS_OFFICE",
7537
7738
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7538
- validUntil: null,
7539
7739
  externalId: "Vg1Bq5XeH9Lt"
7540
7740
  },
7541
7741
  {
@@ -7543,7 +7743,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7543
7743
  name: "Isango District Office",
7544
7744
  locationType: "CRVS_OFFICE",
7545
7745
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7546
- validUntil: null,
7547
7746
  externalId: "Je7Lm2XqN9Vz"
7548
7747
  },
7549
7748
  {
@@ -7551,7 +7750,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7551
7750
  name: "Sulaka Provincial Office",
7552
7751
  locationType: "CRVS_OFFICE",
7553
7752
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7554
- validUntil: null,
7555
7753
  externalId: "Ht2Wp9KcX5Qv"
7556
7754
  },
7557
7755
  {
@@ -7559,7 +7757,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7559
7757
  name: "Ilanga District Office",
7560
7758
  locationType: "CRVS_OFFICE",
7561
7759
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7562
- validUntil: null,
7563
7760
  externalId: "Yp6Ds1WqN3Xz"
7564
7761
  },
7565
7762
  {
@@ -7567,7 +7764,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7567
7764
  name: "Chamakubi Health Post",
7568
7765
  locationType: "HEALTH_FACILITY",
7569
7766
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7570
- validUntil: null,
7571
7767
  externalId: "M1nFr8LbC2Qy"
7572
7768
  },
7573
7769
  {
@@ -7575,7 +7771,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7575
7771
  name: "Ibombo Rural Health Centre",
7576
7772
  locationType: "HEALTH_FACILITY",
7577
7773
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7578
- validUntil: null,
7579
7774
  externalId: "bT7pV6YrW0Xc"
7580
7775
  },
7581
7776
  {
@@ -7583,7 +7778,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7583
7778
  name: "Chikobo Rural Health Centre",
7584
7779
  locationType: "HEALTH_FACILITY",
7585
7780
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7586
- validUntil: null,
7587
7781
  externalId: "zE4qPn2SgJ5d"
7588
7782
  },
7589
7783
  {
@@ -7591,7 +7785,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7591
7785
  name: "Chilochabalenje Health Post",
7592
7786
  locationType: "HEALTH_FACILITY",
7593
7787
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7594
- validUntil: null,
7595
7788
  externalId: "H8vDs1MqR4Uf"
7596
7789
  },
7597
7790
  {
@@ -7599,7 +7792,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7599
7792
  name: "Chipeso Rural Health Centre",
7600
7793
  locationType: "HEALTH_FACILITY",
7601
7794
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7602
- validUntil: null,
7603
7795
  externalId: "Qw3uZ9KfX6Lm"
7604
7796
  },
7605
7797
  {
@@ -7607,7 +7799,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7607
7799
  name: "Chisamba Rural Health Centre",
7608
7800
  locationType: "HEALTH_FACILITY",
7609
7801
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7610
- validUntil: null,
7611
7802
  externalId: "Yr0pCg8LdM2s"
7612
7803
  },
7613
7804
  {
@@ -7615,7 +7806,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7615
7806
  name: "Chitanda Rural Health Centre",
7616
7807
  locationType: "HEALTH_FACILITY",
7617
7808
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7618
- validUntil: null,
7619
7809
  externalId: "tS9gJ4PwB1Qx"
7620
7810
  },
7621
7811
  {
@@ -7623,7 +7813,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7623
7813
  name: "Golden Valley Rural Health Centre",
7624
7814
  locationType: "HEALTH_FACILITY",
7625
7815
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7626
- validUntil: null,
7627
7816
  externalId: "Ld7Qm3XsA8Vr"
7628
7817
  },
7629
7818
  {
@@ -7631,7 +7820,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7631
7820
  name: "Ipongo Rural Health Centre",
7632
7821
  locationType: "HEALTH_FACILITY",
7633
7822
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7634
- validUntil: null,
7635
7823
  externalId: "kF2sW9DmH0Bt"
7636
7824
  },
7637
7825
  {
@@ -7639,7 +7827,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7639
7827
  name: "Itumbwe Health Post",
7640
7828
  locationType: "HEALTH_FACILITY",
7641
7829
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7642
- validUntil: null,
7643
7830
  externalId: "Ue5Xb3VaC7Pq"
7644
7831
  },
7645
7832
  {
@@ -7647,7 +7834,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7647
7834
  name: "Kabangalala Rural Health Centre",
7648
7835
  locationType: "HEALTH_FACILITY",
7649
7836
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7650
- validUntil: null,
7651
7837
  externalId: "Pz8Kc1TqH6Jn"
7652
7838
  },
7653
7839
  // Village offices
@@ -7656,10 +7842,10 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
7656
7842
  name: "Klow Village Office",
7657
7843
  locationType: "CRVS_OFFICE",
7658
7844
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7659
- validUntil: null,
7660
7845
  externalId: "PmAyxAJkxiJ"
7661
7846
  }
7662
7847
  ];
7848
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
7663
7849
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7664
7850
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7665
7851
  );
@@ -7667,8 +7853,56 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7667
7853
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7668
7854
  );
7669
7855
 
7670
- // ../commons/src/notification/UserNotifications.ts
7856
+ // ../commons/src/events/locationPayloads.ts
7671
7857
  var z44 = __toESM(require("zod/v4"));
7858
+ var CreateLocationPayload = z44.object({
7859
+ id: UUID.optional(),
7860
+ versionId: UUID.optional(),
7861
+ name: z44.string(),
7862
+ externalId: z44.string().nullish(),
7863
+ administrativeAreaId: UUID.nullable(),
7864
+ locationType: z44.string().nullable(),
7865
+ effectiveFrom: z44.iso.date().optional(),
7866
+ status: LocationStatus.default("active")
7867
+ });
7868
+ var UpdateLocationPayload = z44.strictObject({
7869
+ id: UUID,
7870
+ versionId: UUID.optional(),
7871
+ name: z44.string(),
7872
+ externalId: z44.string().nullish(),
7873
+ status: LocationStatus,
7874
+ effectiveFrom: z44.iso.date().optional(),
7875
+ lastVersionId: UUID
7876
+ });
7877
+ var WithdrawLocationVersionPayload = z44.object({
7878
+ id: UUID,
7879
+ versionId: UUID
7880
+ });
7881
+ var CreateAdministrativeAreaPayload = z44.object({
7882
+ id: UUID.optional(),
7883
+ versionId: UUID.optional(),
7884
+ name: z44.string(),
7885
+ externalId: z44.string().nullish(),
7886
+ parentId: UUID.nullable(),
7887
+ effectiveFrom: z44.iso.date().optional(),
7888
+ status: LocationStatus.default("active")
7889
+ });
7890
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
7891
+ id: UUID,
7892
+ versionId: UUID.optional(),
7893
+ name: z44.string(),
7894
+ externalId: z44.string().nullish(),
7895
+ status: LocationStatus,
7896
+ effectiveFrom: z44.iso.date().optional(),
7897
+ lastVersionId: UUID
7898
+ });
7899
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
7900
+ id: UUID,
7901
+ versionId: UUID
7902
+ });
7903
+
7904
+ // ../commons/src/notification/UserNotifications.ts
7905
+ var z45 = __toESM(require("zod/v4"));
7672
7906
  var TriggerEvent = {
7673
7907
  USER_CREATED: "user-created",
7674
7908
  USER_UPDATED: "user-updated",
@@ -7681,54 +7915,54 @@ var TriggerEvent = {
7681
7915
  CHANGE_PHONE_NUMBER: "change-phone-number",
7682
7916
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7683
7917
  };
7684
- var Recipient = z44.object({
7918
+ var Recipient = z45.object({
7685
7919
  name: NameFieldValue.optional(),
7686
- mobile: z44.string().optional(),
7687
- email: z44.string().optional(),
7688
- bcc: z44.array(z44.string()).optional()
7920
+ mobile: z45.string().optional(),
7921
+ email: z45.string().optional(),
7922
+ bcc: z45.array(z45.string()).optional()
7689
7923
  });
7690
- var BasePayload = z44.object({
7924
+ var BasePayload = z45.object({
7691
7925
  recipient: Recipient
7692
7926
  });
7693
7927
  var TriggerPayload = {
7694
7928
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7695
- username: z44.string(),
7696
- temporaryPassword: z44.string()
7929
+ username: z45.string(),
7930
+ temporaryPassword: z45.string()
7697
7931
  }),
7698
7932
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7699
- oldUsername: z44.string(),
7700
- newUsername: z44.string()
7933
+ oldUsername: z45.string(),
7934
+ newUsername: z45.string()
7701
7935
  }),
7702
7936
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7703
- username: z44.string()
7937
+ username: z45.string()
7704
7938
  }),
7705
7939
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7706
- code: z44.string()
7940
+ code: z45.string()
7707
7941
  }),
7708
7942
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7709
- temporaryPassword: z44.string(),
7710
- admin: z44.object({
7711
- id: z44.string(),
7943
+ temporaryPassword: z45.string(),
7944
+ admin: z45.object({
7945
+ id: z45.string(),
7712
7946
  name: NameFieldValue,
7713
- role: z44.string()
7947
+ role: z45.string()
7714
7948
  })
7715
7949
  }),
7716
7950
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7717
- username: z44.string(),
7718
- temporaryPassword: z44.string()
7951
+ username: z45.string(),
7952
+ temporaryPassword: z45.string()
7719
7953
  }),
7720
7954
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7721
- code: z44.string()
7955
+ code: z45.string()
7722
7956
  }),
7723
7957
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7724
- subject: z44.string(),
7725
- body: z44.string()
7958
+ subject: z45.string(),
7959
+ body: z45.string()
7726
7960
  }),
7727
7961
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7728
- code: z44.string()
7962
+ code: z45.string()
7729
7963
  }),
7730
7964
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7731
- code: z44.string()
7965
+ code: z45.string()
7732
7966
  })
7733
7967
  };
7734
7968
  async function triggerUserEventNotification({
@@ -7752,4 +7986,4 @@ function parseUserEventTrigger(event2, body) {
7752
7986
  }
7753
7987
 
7754
7988
  // src/notification/index.ts
7755
- z45.globalRegistry.clear();
7989
+ z46.globalRegistry.clear();