@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
@@ -80,6 +80,8 @@ __export(events_exports, {
80
80
  ConditionalType: () => ConditionalType,
81
81
  ConfirmableActions: () => ConfirmableActions,
82
82
  ContainsFlags: () => ContainsFlags,
83
+ CreateAdministrativeAreaPayload: () => CreateAdministrativeAreaPayload,
84
+ CreateLocationPayload: () => CreateLocationPayload,
83
85
  CustomActionInput: () => CustomActionInput,
84
86
  CustomFieldValue: () => CustomFieldValue,
85
87
  CustomFlag: () => CustomFlag,
@@ -161,7 +163,9 @@ __export(events_exports, {
161
163
  LanguageConfig: () => LanguageConfig,
162
164
  LegalStatuses: () => LegalStatuses,
163
165
  Location: () => Location,
166
+ LocationStatus: () => LocationStatus,
164
167
  LocationTypeV1: () => LocationTypeV1,
168
+ LocationVersion: () => LocationVersion,
165
169
  METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
166
170
  MarkAsDuplicateActionInput: () => MarkAsDuplicateActionInput,
167
171
  MarkNotDuplicateActionInput: () => MarkNotDuplicateActionInput,
@@ -201,6 +205,8 @@ __export(events_exports, {
201
205
  SelectDateRangeOption: () => SelectDateRangeOption,
202
206
  SelectDateRangeValue: () => SelectDateRangeValue,
203
207
  SelectOption: () => SelectOption,
208
+ SetAdministrativeAreaPayload: () => SetAdministrativeAreaPayload,
209
+ SetLocationPayload: () => SetLocationPayload,
204
210
  ShowConditional: () => ShowConditional,
205
211
  SignatureFieldValue: () => SignatureFieldValue,
206
212
  StaticDataEntry: () => StaticDataEntry,
@@ -214,7 +220,10 @@ __export(events_exports, {
214
220
  TimeValue: () => TimeValue,
215
221
  TranslationConfig: () => TranslationConfig,
216
222
  UUID: () => UUID,
223
+ UnarchiveActionInput: () => UnarchiveActionInput,
217
224
  UnassignActionInput: () => UnassignActionInput,
225
+ UpdateAdministrativeAreaPayload: () => UpdateAdministrativeAreaPayload,
226
+ UpdateLocationPayload: () => UpdateLocationPayload,
218
227
  UserAuditRecordInput: () => UserAuditRecordInput,
219
228
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
220
229
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP,
@@ -224,6 +233,8 @@ __export(events_exports, {
224
233
  VerificationActionConfig: () => VerificationActionConfig,
225
234
  VerificationPageConfig: () => VerificationPageConfig,
226
235
  VerificationStatusValue: () => VerificationStatusValue,
236
+ WithdrawAdministrativeAreaVersionPayload: () => WithdrawAdministrativeAreaVersionPayload,
237
+ WithdrawLocationVersionPayload: () => WithdrawLocationVersionPayload,
227
238
  Within: () => Within,
228
239
  WorkqueueActionType: () => WorkqueueActionType,
229
240
  WorkqueueColumn: () => WorkqueueColumn,
@@ -312,6 +323,7 @@ __export(events_exports, {
312
323
  getActionAnnotation: () => getActionAnnotation,
313
324
  getActionAnnotationFields: () => getActionAnnotationFields,
314
325
  getActionConfig: () => getActionConfig,
326
+ getActionFormFields: () => getActionFormFields,
315
327
  getActionReview: () => getActionReview,
316
328
  getActionReviewFields: () => getActionReviewFields,
317
329
  getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
@@ -341,6 +353,7 @@ __export(events_exports, {
341
353
  getStatusFromActions: () => getStatusFromActions,
342
354
  getValidatorsForField: () => getValidatorsForField,
343
355
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
356
+ hasActiveExternalIdOnOrAfter: () => hasActiveExternalIdOnOrAfter,
344
357
  hasAnyOfScopes: () => hasAnyOfScopes,
345
358
  isActionAvailable: () => isActionAvailable,
346
359
  isActionConfigType: () => isActionConfigType,
@@ -431,6 +444,7 @@ __export(events_exports, {
431
444
  resolveDateOfEvent: () => resolveDateOfEvent,
432
445
  resolveEventCustomFlags: () => resolveEventCustomFlags,
433
446
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
447
+ resolveVersion: () => resolveVersion,
434
448
  runClientFunction: () => runClientFunction,
435
449
  runFieldValidations: () => runFieldValidations,
436
450
  runStructuralValidations: () => runStructuralValidations,
@@ -481,6 +495,7 @@ var RecordScopeTypeV2 = z2.enum([
481
495
  "record.edit",
482
496
  "record.reject",
483
497
  "record.archive",
498
+ "record.unarchive",
484
499
  "record.review-duplicates",
485
500
  "record.register",
486
501
  "record.print-certified-copies",
@@ -497,6 +512,7 @@ var PlainScopeType = z2.enum([
497
512
  "integration.create",
498
513
  "record.import",
499
514
  "config.update-all",
515
+ "location.edit",
500
516
  "attachment.upload",
501
517
  "profile.electronic-signature",
502
518
  "user.read-only-my-audit",
@@ -520,11 +536,13 @@ var scopeOptionsPlaceEvent = z2.object({
520
536
  event: scopeByEvent,
521
537
  placeOfEvent: JurisdictionFilter.optional()
522
538
  }).describe("Options applicable to all record scopes.");
523
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
539
+ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
540
+ notifiedIn: JurisdictionFilter.optional(),
541
+ notifiedBy: UserFilter.optional(),
524
542
  declaredIn: JurisdictionFilter.optional(),
525
543
  declaredBy: UserFilter.optional()
526
544
  }).describe("Options applicable to actions that may take place after DECLARE");
527
- var AllRecordScopeOptions = scopeOptionsDeclared.extend({
545
+ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
528
546
  registeredIn: JurisdictionFilter.optional(),
529
547
  registeredBy: UserFilter.optional()
530
548
  }).describe(
@@ -562,6 +580,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
562
580
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
563
581
  );
564
582
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
583
+ notifiedIn: UUID.nullish(),
584
+ notifiedBy: z2.string().optional(),
565
585
  declaredIn: UUID.nullish(),
566
586
  declaredBy: z2.string().optional()
567
587
  }).describe(
@@ -582,6 +602,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
582
602
  "record.edit",
583
603
  "record.reject",
584
604
  "record.archive",
605
+ "record.unarchive",
585
606
  "record.review-duplicates",
586
607
  "record.register"
587
608
  ]);
@@ -607,7 +628,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
607
628
  }),
608
629
  z2.object({
609
630
  type: ScopesWithDeclaredOptions,
610
- options: scopeOptionsDeclared.optional()
631
+ options: scopeOptionsDeclaredOrNotified.optional()
611
632
  }),
612
633
  z2.object({
613
634
  type: ScopesWithFullOptions,
@@ -730,8 +751,9 @@ var decodeScope = (encodedScope) => {
730
751
  var DEFAULT_SCOPE_OPTIONS = {
731
752
  placeOfEvent: JurisdictionFilter.enum.all,
732
753
  accessLevel: JurisdictionFilter.enum.all,
733
- registeredIn: JurisdictionFilter.enum.all,
734
- declaredIn: JurisdictionFilter.enum.all
754
+ notifiedIn: JurisdictionFilter.enum.all,
755
+ declaredIn: JurisdictionFilter.enum.all,
756
+ registeredIn: JurisdictionFilter.enum.all
735
757
  };
736
758
  function getAcceptedScopesByType({
737
759
  acceptedScopes,
@@ -767,6 +789,7 @@ var ActionType = {
767
789
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
768
790
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
769
791
  ARCHIVE: "ARCHIVE",
792
+ UNARCHIVE: "UNARCHIVE",
770
793
  // Record actions
771
794
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
772
795
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -786,6 +809,7 @@ var ConfirmableActions = [
786
809
  ActionType.REGISTER,
787
810
  ActionType.REJECT,
788
811
  ActionType.ARCHIVE,
812
+ ActionType.UNARCHIVE,
789
813
  ActionType.PRINT_CERTIFICATE,
790
814
  ActionType.REQUEST_CORRECTION,
791
815
  ActionType.APPROVE_CORRECTION,
@@ -804,6 +828,7 @@ var ActionTypes = z4.enum([
804
828
  "MARK_AS_DUPLICATE",
805
829
  "MARK_AS_NOT_DUPLICATE",
806
830
  "ARCHIVE",
831
+ "UNARCHIVE",
807
832
  "PRINT_CERTIFICATE",
808
833
  "REQUEST_CORRECTION",
809
834
  "REJECT_CORRECTION",
@@ -847,6 +872,7 @@ var WorkqueueActionType = ActionTypes.extract([
847
872
  ActionType.REJECT,
848
873
  ActionType.MARK_AS_DUPLICATE,
849
874
  ActionType.ARCHIVE,
875
+ ActionType.UNARCHIVE,
850
876
  ActionType.PRINT_CERTIFICATE,
851
877
  ActionType.REQUEST_CORRECTION
852
878
  ]);
@@ -911,6 +937,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
911
937
  "event.actions.unassign.request",
912
938
  "event.actions.read.request",
913
939
  "event.actions.archive.request",
940
+ "event.actions.unarchive.request",
914
941
  "event.actions.reinstate.request",
915
942
  "event.actions.print_certificate.request",
916
943
  "event.actions.correction.request.request",
@@ -968,6 +995,29 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
968
995
  requestData: z5.object({ id: z5.string() }),
969
996
  responseSummary: z5.object({ clientId: z5.string() })
970
997
  });
998
+ var createdVersionFields = {
999
+ id: z5.string(),
1000
+ versionId: z5.string(),
1001
+ name: z5.string(),
1002
+ externalId: z5.string().nullish(),
1003
+ effectiveFrom: z5.string(),
1004
+ status: z5.string()
1005
+ };
1006
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
1007
+ operation: z5.literal("locations.create"),
1008
+ requestData: z5.object({
1009
+ ...createdVersionFields,
1010
+ administrativeAreaId: z5.string().nullish(),
1011
+ locationType: z5.string().nullish()
1012
+ })
1013
+ });
1014
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
1015
+ operation: z5.literal("administrativeAreas.create"),
1016
+ requestData: z5.object({
1017
+ ...createdVersionFields,
1018
+ parentId: z5.string().nullish()
1019
+ })
1020
+ });
971
1021
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
972
1022
  operation: z5.literal("attachments.upload"),
973
1023
  requestData: z5.object({
@@ -1043,6 +1093,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
1043
1093
  IntegrationActivateEntrySchema,
1044
1094
  IntegrationDeleteEntrySchema,
1045
1095
  IntegrationRefreshSecretEntrySchema,
1096
+ LocationCreateEntrySchema,
1097
+ AdministrativeAreaCreateEntrySchema,
1046
1098
  AttachmentUploadEntrySchema,
1047
1099
  UserCreateEntrySchema,
1048
1100
  UserReasonEntrySchema,
@@ -1644,6 +1696,11 @@ var ArchiveAction = ActionBase.extend(
1644
1696
  content: ReasonContent
1645
1697
  }).shape
1646
1698
  );
1699
+ var UnarchiveAction = ActionBase.extend(
1700
+ z14.object({
1701
+ type: z14.literal(ActionType.UNARCHIVE)
1702
+ }).shape
1703
+ );
1647
1704
  var CreatedAction = ActionBase.extend(
1648
1705
  z14.object({
1649
1706
  type: z14.literal(ActionType.CREATE)
@@ -1657,9 +1714,10 @@ var NotifiedAction = ActionBase.extend(
1657
1714
  var EditAction = ActionBase.extend(
1658
1715
  z14.object({
1659
1716
  type: z14.literal(ActionType.EDIT),
1717
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1660
1718
  content: z14.object({
1661
1719
  comment: z14.string().describe("Comment for the edit action.").optional()
1662
- })
1720
+ }).optional()
1663
1721
  }).shape
1664
1722
  );
1665
1723
  var PrintContent = z14.object({
@@ -1710,6 +1768,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1710
1768
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1711
1769
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1712
1770
  ArchiveAction.meta({ id: "ArchiveAction" }),
1771
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1713
1772
  NotifiedAction.meta({ id: "NotifiedAction" }),
1714
1773
  RegisterAction.meta({ id: "RegisterAction" }),
1715
1774
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1815,6 +1874,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1815
1874
  )
1816
1875
  });
1817
1876
  var LegalStatuses = z16.object({
1877
+ [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1818
1878
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1819
1879
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1820
1880
  });
@@ -1956,6 +2016,8 @@ var eventMetadataLabelMap = {
1956
2016
  var EventMetadataDateFieldIdInput = z16.enum([
1957
2017
  "createdAt",
1958
2018
  "updatedAt",
2019
+ "legalStatuses.NOTIFIED.createdAt",
2020
+ "legalStatuses.NOTIFIED.acceptedAt",
1959
2021
  "legalStatuses.DECLARED.createdAt",
1960
2022
  "legalStatuses.DECLARED.acceptedAt",
1961
2023
  "legalStatuses.REGISTERED.createdAt",
@@ -1964,6 +2026,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
1964
2026
  var EventMetadataDateFieldId = z16.enum([
1965
2027
  "event.createdAt",
1966
2028
  "event.updatedAt",
2029
+ "event.legalStatuses.NOTIFIED.createdAt",
2030
+ "event.legalStatuses.NOTIFIED.acceptedAt",
1967
2031
  "event.legalStatuses.DECLARED.createdAt",
1968
2032
  "event.legalStatuses.DECLARED.acceptedAt",
1969
2033
  "event.legalStatuses.REGISTERED.createdAt",
@@ -2023,7 +2087,8 @@ var Range = import_v4.z.object({
2023
2087
  });
2024
2088
  var ContainsFlags = import_v4.z.object({
2025
2089
  anyOf: import_v4.z.array(Flag).optional(),
2026
- noneOf: import_v4.z.array(Flag).optional()
2090
+ noneOf: import_v4.z.array(Flag).optional(),
2091
+ allOf: import_v4.z.array(Flag).optional()
2027
2092
  }).meta({
2028
2093
  id: "ContainsFlags"
2029
2094
  });
@@ -3213,6 +3278,9 @@ var ActionConfigBase = z24.object({
3213
3278
  var DeclarationActionBase = ActionConfigBase.extend({
3214
3279
  deduplication: DeduplicationConfig.optional()
3215
3280
  });
3281
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
3282
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
3283
+ );
3216
3284
  var ReadActionConfig = ActionConfigBase.extend(
3217
3285
  z24.object({
3218
3286
  type: z24.literal(ActionType.READ),
@@ -3222,12 +3290,65 @@ var ReadActionConfig = ActionConfigBase.extend(
3222
3290
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
3223
3291
  }).shape
3224
3292
  );
3293
+ var NotifyConfig = ActionConfigBase.extend(
3294
+ z24.object({
3295
+ type: z24.literal(ActionType.NOTIFY),
3296
+ form: actionConfirmationForm
3297
+ }).shape
3298
+ );
3299
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
3300
+ z24.object({
3301
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
3302
+ label: z24.never().optional().describe(
3303
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
3304
+ ),
3305
+ supportingCopy: z24.never().optional(),
3306
+ icon: z24.never().optional().describe(
3307
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
3308
+ ),
3309
+ conditionals: z24.never().optional().describe(
3310
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
3311
+ )
3312
+ }).shape
3313
+ );
3314
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
3315
+ z24.object({
3316
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
3317
+ }).shape
3318
+ );
3319
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
3320
+ z24.object({
3321
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
3322
+ }).shape
3323
+ );
3324
+ var AssignConfig = ActionConfigBase.extend(
3325
+ z24.object({
3326
+ type: z24.literal(ActionType.ASSIGN),
3327
+ flags: z24.never().optional().describe(
3328
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3329
+ )
3330
+ }).shape
3331
+ );
3332
+ var UnassignConfig = ActionConfigBase.extend(
3333
+ z24.object({
3334
+ type: z24.literal(ActionType.UNASSIGN),
3335
+ flags: z24.never().optional().describe(
3336
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3337
+ )
3338
+ }).shape
3339
+ );
3340
+ var DeleteConfig = ActionConfigBase.extend(
3341
+ z24.object({
3342
+ type: z24.literal(ActionType.DELETE)
3343
+ }).shape
3344
+ );
3225
3345
  var DeclareConfig = DeclarationActionBase.extend(
3226
3346
  z24.object({
3227
3347
  type: z24.literal(ActionType.DECLARE),
3228
3348
  review: DeclarationReviewConfig.describe(
3229
3349
  "Configuration of the review page fields."
3230
3350
  ),
3351
+ form: actionConfirmationForm,
3231
3352
  dialogCopy: z24.object({
3232
3353
  notify: TranslationConfig.describe(
3233
3354
  "Confirmation text for the notify action"
@@ -3243,7 +3364,13 @@ var DeclareConfig = DeclarationActionBase.extend(
3243
3364
  );
3244
3365
  var ArchiveConfig = ActionConfigBase.extend(
3245
3366
  z24.object({
3246
- type: z24.literal(ActionType.ARCHIVE)
3367
+ type: z24.literal(ActionType.ARCHIVE),
3368
+ form: actionConfirmationForm
3369
+ }).shape
3370
+ );
3371
+ var UnarchiveConfig = ActionConfigBase.extend(
3372
+ z24.object({
3373
+ type: z24.literal(ActionType.UNARCHIVE)
3247
3374
  }).shape
3248
3375
  );
3249
3376
  var EditActionConfig = ActionConfigBase.extend(
@@ -3264,12 +3391,14 @@ var EditActionConfig = ActionConfigBase.extend(
3264
3391
  );
3265
3392
  var RejectConfig = ActionConfigBase.extend(
3266
3393
  z24.object({
3267
- type: z24.literal(ActionType.REJECT)
3394
+ type: z24.literal(ActionType.REJECT),
3395
+ form: actionConfirmationForm
3268
3396
  }).shape
3269
3397
  );
3270
3398
  var RegisterConfig = DeclarationActionBase.extend(
3271
3399
  z24.object({
3272
- type: z24.literal(ActionType.REGISTER)
3400
+ type: z24.literal(ActionType.REGISTER),
3401
+ form: actionConfirmationForm
3273
3402
  }).shape
3274
3403
  );
3275
3404
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -3284,7 +3413,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
3284
3413
  correctionForm: ActionFormConfig
3285
3414
  }).shape
3286
3415
  );
3287
- var CustomActionConfig = ActionConfigBase.merge(
3416
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
3417
+ z24.object({
3418
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
3419
+ }).shape
3420
+ );
3421
+ var RejectCorrectionConfig = ActionConfigBase.extend(
3422
+ z24.object({
3423
+ type: z24.literal(ActionType.REJECT_CORRECTION)
3424
+ }).shape
3425
+ );
3426
+ var CustomActionConfig = ActionConfigBase.extend(
3288
3427
  z24.object({
3289
3428
  type: z24.literal(ActionType.CUSTOM),
3290
3429
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -3295,7 +3434,7 @@ var CustomActionConfig = ActionConfigBase.merge(
3295
3434
  auditHistoryLabel: TranslationConfig.describe(
3296
3435
  'The label to show in audit history for this action. For example "Approved".'
3297
3436
  )
3298
- })
3437
+ }).shape
3299
3438
  );
3300
3439
  var ActionConfig = z24.discriminatedUnion("type", [
3301
3440
  /*
@@ -3306,9 +3445,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
3306
3445
  id: "ReadActionConfig",
3307
3446
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3308
3447
  }),
3448
+ AssignConfig.meta({
3449
+ id: "AssignActionConfig",
3450
+ description: "Configuration for assigning a record to the current user."
3451
+ }),
3452
+ UnassignConfig.meta({
3453
+ id: "UnassignActionConfig",
3454
+ description: "Configuration for unassigning a record from its current assignee."
3455
+ }),
3456
+ DeleteConfig.meta({
3457
+ id: "DeleteActionConfig",
3458
+ description: "Configuration for deleting a draft record."
3459
+ }),
3460
+ NotifyConfig.meta({
3461
+ id: "NotifyActionConfig",
3462
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
3463
+ }),
3309
3464
  DeclareConfig.meta({
3310
3465
  id: "DeclareActionConfig",
3311
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
3466
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3467
+ }),
3468
+ DuplicateDetectedConfig.meta({
3469
+ id: "DuplicateDetectedActionConfig",
3470
+ 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."
3471
+ }),
3472
+ MarkAsDuplicateConfig.meta({
3473
+ id: "MarkAsDuplicateActionConfig",
3474
+ description: "Configuration for marking a record as a duplicate."
3475
+ }),
3476
+ MarkAsNotDuplicateConfig.meta({
3477
+ id: "MarkAsNotDuplicateActionConfig",
3478
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
3312
3479
  }),
3313
3480
  RejectConfig.meta({
3314
3481
  id: "RejectActionConfig",
@@ -3326,6 +3493,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
3326
3493
  id: "RequestCorrectionActionConfig",
3327
3494
  description: "Configuration for requesting a correction on a registered record."
3328
3495
  }),
3496
+ ApproveCorrectionConfig.meta({
3497
+ id: "ApproveCorrectionActionConfig",
3498
+ description: "Configuration for approving a requested correction."
3499
+ }),
3500
+ RejectCorrectionConfig.meta({
3501
+ id: "RejectCorrectionActionConfig",
3502
+ description: "Configuration for rejecting a requested correction."
3503
+ }),
3329
3504
  EditActionConfig.meta({
3330
3505
  id: "EditActionConfig",
3331
3506
  description: "Configuration for editing a record before registration."
@@ -3334,6 +3509,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
3334
3509
  id: "ArchiveActionConfig",
3335
3510
  description: "Configuration for archiving a record."
3336
3511
  }),
3512
+ UnarchiveConfig.meta({
3513
+ id: "UnarchiveActionConfig",
3514
+ description: "Configuration for unarchiving a record."
3515
+ }),
3337
3516
  CustomActionConfig.meta({
3338
3517
  id: "CustomActionConfig",
3339
3518
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -4477,16 +4656,13 @@ function getActionConfig({
4477
4656
  actionType,
4478
4657
  customActionType
4479
4658
  }) {
4659
+ if (actionType === ActionType.NOTIFY) {
4660
+ return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
4661
+ }
4480
4662
  return eventConfiguration.actions.find((a) => {
4481
4663
  if (a.type === ActionType.CUSTOM && customActionType) {
4482
4664
  return a.customActionType === customActionType;
4483
4665
  }
4484
- if (actionType === ActionType.NOTIFY) {
4485
- return a.type === ActionType.DECLARE;
4486
- }
4487
- if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
4488
- return a.type === ActionType.REQUEST_CORRECTION;
4489
- }
4490
4666
  return a.type === actionType;
4491
4667
  });
4492
4668
  }
@@ -4496,7 +4672,19 @@ function getCustomActionFields(eventConfiguration, customActionType) {
4496
4672
  customActionType,
4497
4673
  actionType: ActionType.CUSTOM
4498
4674
  });
4499
- if (!actionConfig || !("form" in actionConfig)) {
4675
+ if (!actionConfig || actionConfig.type !== ActionType.CUSTOM) {
4676
+ return [];
4677
+ }
4678
+ return actionConfig.form;
4679
+ }
4680
+ function getActionFormFields(eventConfiguration, actionType, customActionType) {
4681
+ const actionConfig = eventConfiguration.actions.find((a) => {
4682
+ if (a.type === ActionType.CUSTOM && customActionType) {
4683
+ return a.customActionType === customActionType;
4684
+ }
4685
+ return a.type === actionType;
4686
+ });
4687
+ if (!actionConfig || !("form" in actionConfig) || actionConfig.form == null) {
4500
4688
  return [];
4501
4689
  }
4502
4690
  return actionConfig.form;
@@ -4517,13 +4705,9 @@ var getActionAnnotationFields = (actionConfig) => {
4517
4705
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
4518
4706
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
4519
4707
  }
4520
- if (actionConfig.type === ActionType.CUSTOM) {
4521
- return actionConfig.form;
4522
- }
4523
- if ("review" in actionConfig) {
4524
- return actionConfig.review.fields;
4525
- }
4526
- return [];
4708
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
4709
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
4710
+ return [...reviewFields, ...formFields];
4527
4711
  };
4528
4712
  function getAllAnnotationFields(config) {
4529
4713
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -5640,7 +5824,7 @@ function validateActionFlags(event2, ctx) {
5640
5824
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
5641
5825
  const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
5642
5826
  const actionFlagIds = event2.actions.flatMap(
5643
- (action) => action.flags.map((flag2) => flag2.id)
5827
+ (action) => (action.flags ?? []).map((flag2) => flag2.id)
5644
5828
  );
5645
5829
  for (const actionFlagId of actionFlagIds) {
5646
5830
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -6270,10 +6454,7 @@ var DeclareActionInput = BaseActionInput.extend(
6270
6454
  );
6271
6455
  var EditActionInput = BaseActionInput.extend(
6272
6456
  z38.object({
6273
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
6274
- content: z38.object({
6275
- comment: z38.string().describe("Comment for the edit action.").optional()
6276
- })
6457
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
6277
6458
  }).shape
6278
6459
  );
6279
6460
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -6315,6 +6496,11 @@ var ArchiveActionInput = BaseActionInput.extend(
6315
6496
  content: ReasonContent
6316
6497
  }).shape
6317
6498
  );
6499
+ var UnarchiveActionInput = BaseActionInput.extend(
6500
+ z38.object({
6501
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
6502
+ }).shape
6503
+ );
6318
6504
  var AssignActionInput = BaseActionInput.extend(
6319
6505
  z38.object({
6320
6506
  type: z38.literal(ActionType.ASSIGN),
@@ -6376,6 +6562,7 @@ var ActionInput = z38.discriminatedUnion("type", [
6376
6562
  id: "MarkNotDuplicateActionInput"
6377
6563
  }),
6378
6564
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
6565
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
6379
6566
  AssignActionInput.meta({ id: "AssignActionInput" }),
6380
6567
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
6381
6568
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -6490,6 +6677,7 @@ var updateActions = ActionTypes.extract([
6490
6677
  ActionType.REGISTER,
6491
6678
  ActionType.REJECT,
6492
6679
  ActionType.ARCHIVE,
6680
+ ActionType.UNARCHIVE,
6493
6681
  ActionType.PRINT_CERTIFICATE,
6494
6682
  ActionType.REQUEST_CORRECTION,
6495
6683
  ActionType.APPROVE_CORRECTION,
@@ -6521,6 +6709,10 @@ function getActionUpdateMetadata(actions) {
6521
6709
  }
6522
6710
  function getLegalStatuses(actions) {
6523
6711
  return {
6712
+ [EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
6713
+ ActionType.NOTIFY,
6714
+ actions
6715
+ ),
6524
6716
  [EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
6525
6717
  ActionType.DECLARE,
6526
6718
  actions
@@ -6607,15 +6799,12 @@ var INHERENT_FLAG_RULES = [
6607
6799
  },
6608
6800
  {
6609
6801
  // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
6610
- // other status-changing action (see getStatusFromActions).
6802
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
6803
+ // are deliberately excluded so the flag freezes across an archive/unarchive
6804
+ // round trip and comes back exactly as it was.
6611
6805
  flag: InherentFlags.INCOMPLETE,
6612
6806
  setOn: [ActionType.NOTIFY],
6613
- resetOn: [
6614
- ActionType.CREATE,
6615
- ActionType.DECLARE,
6616
- ActionType.REGISTER,
6617
- ActionType.ARCHIVE
6618
- ]
6807
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
6619
6808
  },
6620
6809
  {
6621
6810
  flag: InherentFlags.REJECTED,
@@ -6679,7 +6868,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
6679
6868
  const declaration = aggregateActionDeclarations(eventUpToThisAction);
6680
6869
  const annotation = aggregateActionAnnotations(eventUpToThisAction);
6681
6870
  const form = { ...declaration, ...annotation };
6682
- const flagsWithMetConditions = actionConfig.flags.filter(
6871
+ const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
6683
6872
  ({ conditional }) => (
6684
6873
  // If conditional is not provided, the flag is resolved
6685
6874
  conditional ? isFlagConditionMet(conditional, form, action) : true
@@ -6725,7 +6914,27 @@ function getEventFlags(event2, config) {
6725
6914
 
6726
6915
  // ../commons/src/events/state/index.ts
6727
6916
  function getStatusFromActions(actions) {
6728
- return actions.filter(({ status: status2 }) => status2 === ActionStatus.Accepted).reduce((status2, action) => {
6917
+ const acceptedActions = actions.filter(
6918
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
6919
+ );
6920
+ const isCurrentlyArchived = acceptedActions.reduce(
6921
+ (archived, action) => {
6922
+ if (action.type === ActionType.ARCHIVE) {
6923
+ return true;
6924
+ }
6925
+ if (action.type === ActionType.UNARCHIVE) {
6926
+ return false;
6927
+ }
6928
+ return archived;
6929
+ },
6930
+ false
6931
+ );
6932
+ if (isCurrentlyArchived) {
6933
+ return EventStatus.enum.ARCHIVED;
6934
+ }
6935
+ return acceptedActions.filter(
6936
+ ({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
6937
+ ).reduce((status2, action) => {
6729
6938
  switch (action.type) {
6730
6939
  case ActionType.CREATE:
6731
6940
  return EventStatus.enum.CREATED;
@@ -6733,10 +6942,11 @@ function getStatusFromActions(actions) {
6733
6942
  return EventStatus.enum.DECLARED;
6734
6943
  case ActionType.REGISTER:
6735
6944
  return EventStatus.enum.REGISTERED;
6736
- case ActionType.ARCHIVE:
6737
- return EventStatus.enum.ARCHIVED;
6738
6945
  case ActionType.NOTIFY:
6739
6946
  return EventStatus.enum.NOTIFIED;
6947
+ // Already filtered out above; listed here only to satisfy exhaustiveness.
6948
+ case ActionType.ARCHIVE:
6949
+ case ActionType.UNARCHIVE:
6740
6950
  case ActionType.CUSTOM:
6741
6951
  case ActionType.PRINT_CERTIFICATE:
6742
6952
  case ActionType.ASSIGN:
@@ -8284,6 +8494,20 @@ var tennisClubMembershipEvent = defineConfig({
8284
8494
  },
8285
8495
  review: TENNIS_CLUB_DECLARATION_REVIEW
8286
8496
  },
8497
+ {
8498
+ type: ActionType.NOTIFY,
8499
+ label: {
8500
+ defaultMessage: "Notify health worker",
8501
+ description: "This is shown as the action name anywhere the user can trigger the action from",
8502
+ id: "event.tennis-club-membership.action.notify.label"
8503
+ },
8504
+ flags: [
8505
+ {
8506
+ id: "health-worker-notified",
8507
+ operation: "add"
8508
+ }
8509
+ ]
8510
+ },
8287
8511
  {
8288
8512
  type: ActionType.REJECT,
8289
8513
  label: {
@@ -8526,6 +8750,17 @@ var tennisClubMembershipEvent = defineConfig({
8526
8750
  }
8527
8751
  }
8528
8752
  ],
8753
+ flags: [
8754
+ {
8755
+ id: "health-worker-notified",
8756
+ requiresAction: false,
8757
+ label: {
8758
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
8759
+ defaultMessage: "Health worker notified",
8760
+ description: "Label for the health-worker-notified flag"
8761
+ }
8762
+ }
8763
+ ],
8529
8764
  advancedSearch: [
8530
8765
  {
8531
8766
  title: {
@@ -9764,7 +9999,6 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
9764
9999
  },
9765
10000
  edit: (eventId, input = {}) => ({
9766
10001
  type: ActionType.EDIT,
9767
- content: { comment: "Test comment" },
9768
10002
  transactionId: input.transactionId ?? getUUID(),
9769
10003
  declaration: input.declaration ?? generateActionDeclarationInput(configuration, ActionType.EDIT, rng),
9770
10004
  annotation: input.annotation ?? generateActionAnnotationInput(configuration, ActionType.EDIT, rng),
@@ -9796,6 +10030,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
9796
10030
  },
9797
10031
  ...input
9798
10032
  }),
10033
+ unarchive: (eventId, input = {}) => ({
10034
+ type: ActionType.UNARCHIVE,
10035
+ transactionId: input.transactionId ?? getUUID(),
10036
+ declaration: {},
10037
+ annotation: {},
10038
+ eventId,
10039
+ ...input
10040
+ }),
9799
10041
  reject: (eventId, input = {}) => ({
9800
10042
  type: ActionType.REJECT,
9801
10043
  transactionId: input.transactionId ?? getUUID(),
@@ -9954,6 +10196,7 @@ function generateActionDocument({
9954
10196
  case ActionType.NOTIFY:
9955
10197
  case ActionType.REGISTER:
9956
10198
  case ActionType.REQUEST_CORRECTION:
10199
+ case ActionType.UNARCHIVE:
9957
10200
  return { ...actionBase, type: action };
9958
10201
  case ActionType.EDIT:
9959
10202
  return {
@@ -10261,21 +10504,60 @@ var LocationTypeV1 = z43.enum([
10261
10504
  "CRVS_OFFICE",
10262
10505
  "HEALTH_FACILITY"
10263
10506
  ]);
10507
+ var LocationStatus = z43.enum(["active", "inactive"]);
10508
+ var LocationVersion = z43.object({
10509
+ versionId: UUID,
10510
+ effectiveFrom: z43.iso.date(),
10511
+ name: z43.string(),
10512
+ externalId: z43.string().nullish(),
10513
+ status: LocationStatus
10514
+ });
10264
10515
  var AdministrativeArea = z43.object({
10265
10516
  id: UUID,
10266
10517
  name: z43.string(),
10267
10518
  externalId: z43.string().nullish(),
10268
10519
  parentId: UUID.nullable(),
10269
- validUntil: z43.iso.datetime().nullable()
10520
+ status: LocationStatus,
10521
+ versions: z43.array(LocationVersion)
10270
10522
  });
10271
10523
  var Location = z43.object({
10272
10524
  id: UUID,
10273
10525
  name: z43.string(),
10274
10526
  externalId: z43.string().nullish(),
10275
10527
  administrativeAreaId: UUID.nullable(),
10276
- validUntil: z43.iso.datetime().nullable(),
10528
+ locationType: z43.string().nullable(),
10529
+ status: LocationStatus,
10530
+ versions: z43.array(LocationVersion)
10531
+ });
10532
+ var SetLocationPayload = z43.object({
10533
+ id: UUID,
10534
+ name: z43.string(),
10535
+ externalId: z43.string().nullish(),
10536
+ administrativeAreaId: UUID.nullable(),
10277
10537
  locationType: z43.string().nullable()
10278
10538
  });
10539
+ var SetAdministrativeAreaPayload = z43.object({
10540
+ id: UUID,
10541
+ name: z43.string(),
10542
+ externalId: z43.string().nullish(),
10543
+ parentId: UUID.nullable()
10544
+ });
10545
+ function resolveVersion(versions, anchor) {
10546
+ let resolved = versions[0];
10547
+ for (const version of versions) {
10548
+ if (version.effectiveFrom <= anchor) {
10549
+ resolved = version;
10550
+ }
10551
+ }
10552
+ return resolved;
10553
+ }
10554
+ function hasActiveExternalIdOnOrAfter(versions, externalId, anchor) {
10555
+ const inEffectAtAnchor = resolveVersion(versions, anchor);
10556
+ const laterVersions = versions.filter((v) => v.effectiveFrom > anchor);
10557
+ return [inEffectAtAnchor, ...laterVersions].some(
10558
+ (v) => v.externalId === externalId && v.status === "active"
10559
+ );
10560
+ }
10279
10561
  function matchesJurisdictionFilter(locationIds, filter, user2) {
10280
10562
  if (!locationIds) {
10281
10563
  return false;
@@ -10311,6 +10593,25 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
10311
10593
  }
10312
10594
  if (scopeUsesDeclaredOptions(scope)) {
10313
10595
  const { options } = scope;
10596
+ if (options?.notifiedBy === UserFilter.enum.user) {
10597
+ if (event2.legalStatuses?.NOTIFIED?.createdBy !== user2.id) {
10598
+ return false;
10599
+ }
10600
+ }
10601
+ if (options?.notifiedIn === JurisdictionFilter.enum.location && !matchesJurisdictionFilter(
10602
+ event2.legalStatuses?.NOTIFIED?.createdAtLocation,
10603
+ JurisdictionFilter.enum.location,
10604
+ user2
10605
+ )) {
10606
+ return false;
10607
+ }
10608
+ if (options?.notifiedIn === JurisdictionFilter.enum.administrativeArea && !matchesJurisdictionFilter(
10609
+ event2.legalStatuses?.NOTIFIED?.createdAtLocation,
10610
+ JurisdictionFilter.enum.administrativeArea,
10611
+ user2
10612
+ )) {
10613
+ return false;
10614
+ }
10314
10615
  if (options?.declaredBy === UserFilter.enum.user) {
10315
10616
  if (event2.legalStatuses?.DECLARED?.createdBy !== user2.id) {
10316
10617
  return false;
@@ -10453,6 +10754,7 @@ var ACTION_SCOPE_MAP = {
10453
10754
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
10454
10755
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
10455
10756
  [ActionType.ARCHIVE]: ["record.archive"],
10757
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
10456
10758
  [ActionType.REJECT]: ["record.reject"],
10457
10759
  [ActionType.ASSIGN]: null,
10458
10760
  [ActionType.UNASSIGN]: null,
@@ -10659,7 +10961,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
10659
10961
  ActionType.CUSTOM,
10660
10962
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
10661
10963
  ],
10662
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
10964
+ [EventStatus.enum.ARCHIVED]: [
10965
+ ActionType.READ,
10966
+ ActionType.CUSTOM,
10967
+ ActionType.UNARCHIVE
10968
+ ]
10663
10969
  };
10664
10970
  var ACTION_FILTERS = {
10665
10971
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
@@ -10672,6 +10978,7 @@ var ACTION_FILTERS = {
10672
10978
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
10673
10979
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
10674
10980
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10981
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10675
10982
  [ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10676
10983
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10677
10984
  [ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
@@ -10730,75 +11037,80 @@ function getFilePathsFromEvent(event2) {
10730
11037
  }
10731
11038
 
10732
11039
  // ../commons/src/events/mocks.test.utils.ts
10733
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11040
+ function withVersionFields(entity) {
11041
+ return {
11042
+ ...entity,
11043
+ status: "active",
11044
+ versions: [
11045
+ {
11046
+ versionId: entity.id,
11047
+ effectiveFrom: "0001-01-01",
11048
+ name: entity.name,
11049
+ externalId: entity.externalId ?? null,
11050
+ status: "active"
11051
+ }
11052
+ ]
11053
+ };
11054
+ }
11055
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
10734
11056
  {
10735
11057
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10736
11058
  name: "Central",
10737
11059
  parentId: null,
10738
- validUntil: null,
10739
11060
  externalId: "ydyJb1RAy4U1"
10740
11061
  },
10741
11062
  {
10742
11063
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10743
11064
  name: "Sulaka",
10744
11065
  parentId: null,
10745
- validUntil: null,
10746
11066
  externalId: "pQ8nGxWmZ2Q3"
10747
11067
  },
10748
11068
  {
10749
11069
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
10750
11070
  name: "Pualula",
10751
11071
  parentId: null,
10752
- validUntil: null,
10753
11072
  externalId: "Aq91DweLmT8k"
10754
11073
  },
10755
11074
  {
10756
11075
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
10757
11076
  name: "Chuminga",
10758
11077
  parentId: null,
10759
- validUntil: null,
10760
11078
  externalId: "Rw0fYNh2Xk9a"
10761
11079
  },
10762
11080
  {
10763
11081
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10764
11082
  name: "Ibombo",
10765
11083
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10766
- validUntil: null,
10767
11084
  externalId: "k7DsP4vbN1Qe"
10768
11085
  },
10769
11086
  {
10770
11087
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
10771
11088
  name: "Isango",
10772
11089
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10773
- validUntil: null,
10774
11090
  externalId: "Gm3Z9eQpHw4L"
10775
11091
  },
10776
11092
  {
10777
11093
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
10778
11094
  name: "Isamba",
10779
11095
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10780
- validUntil: null,
10781
11096
  externalId: "sT0xVu1KqJ7r"
10782
11097
  },
10783
11098
  {
10784
11099
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
10785
11100
  name: "Itambo",
10786
11101
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10787
- validUntil: null,
10788
11102
  externalId: "Nq6Bv2HpL9Te"
10789
11103
  },
10790
11104
  {
10791
11105
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
10792
11106
  name: "Ezhi",
10793
11107
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10794
- validUntil: null,
10795
11108
  externalId: "xK8cQ0ZRy5Wd"
10796
11109
  },
10797
11110
  {
10798
11111
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
10799
11112
  name: "Ilanga",
10800
11113
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10801
- validUntil: null,
10802
11114
  externalId: "Cq4Jm1XvN8Ls"
10803
11115
  },
10804
11116
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -10806,49 +11118,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
10806
11118
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
10807
11119
  name: "Klow",
10808
11120
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10809
- validUntil: null,
10810
11121
  externalId: "IkYcYBUcyY2"
10811
11122
  },
10812
11123
  {
10813
11124
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
10814
11125
  name: "Mbondo",
10815
11126
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10816
- validUntil: null,
10817
11127
  externalId: "Qhvv5hvo3mY"
10818
11128
  },
10819
11129
  {
10820
11130
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
10821
11131
  name: "Ndara",
10822
11132
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10823
- validUntil: null,
10824
11133
  externalId: "crXh068O9TR"
10825
11134
  },
10826
11135
  {
10827
11136
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
10828
11137
  name: "Olani",
10829
11138
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10830
- validUntil: null,
10831
11139
  externalId: "r00It8Tvvp7"
10832
11140
  },
10833
11141
  {
10834
11142
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
10835
11143
  name: "Pemba",
10836
11144
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10837
- validUntil: null,
10838
11145
  externalId: "ZnUWsbONIaH"
10839
11146
  },
10840
11147
  {
10841
11148
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
10842
11149
  name: "Quanza",
10843
11150
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10844
- validUntil: null,
10845
11151
  externalId: "fDZycvQTa7l"
10846
11152
  },
10847
11153
  {
10848
11154
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
10849
11155
  name: "Rivka",
10850
11156
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10851
- validUntil: null,
10852
11157
  externalId: "KqswxCGTELa"
10853
11158
  },
10854
11159
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -10856,35 +11161,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
10856
11161
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
10857
11162
  name: "Mbula",
10858
11163
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10859
- validUntil: null,
10860
11164
  externalId: "osEbKjRc9Kg"
10861
11165
  },
10862
11166
  {
10863
11167
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
10864
11168
  name: "Ndoki",
10865
11169
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10866
- validUntil: null,
10867
11170
  externalId: "aq4daBUAGr3"
10868
11171
  },
10869
11172
  {
10870
11173
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
10871
11174
  name: "Tsanga",
10872
11175
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10873
- validUntil: null,
10874
11176
  externalId: "cqis6Y8trbJ"
10875
11177
  },
10876
11178
  {
10877
11179
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
10878
11180
  name: "Waziri",
10879
11181
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10880
- validUntil: null,
10881
11182
  externalId: "LMijHPyyx6d"
10882
11183
  },
10883
11184
  {
10884
11185
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
10885
11186
  name: "Zimbi",
10886
11187
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10887
- validUntil: null,
10888
11188
  externalId: "pcQYbPuKGZ7"
10889
11189
  },
10890
11190
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -10892,67 +11192,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
10892
11192
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
10893
11193
  name: "Felani",
10894
11194
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10895
- validUntil: null,
10896
11195
  externalId: "gSqpoCGdMXp"
10897
11196
  },
10898
11197
  {
10899
11198
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
10900
11199
  name: "Goroma",
10901
11200
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10902
- validUntil: null,
10903
11201
  externalId: "KvAAIaNqVrp"
10904
11202
  },
10905
11203
  {
10906
11204
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
10907
11205
  name: "Halifu",
10908
11206
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10909
- validUntil: null,
10910
11207
  externalId: "qe4UnEVt1hv"
10911
11208
  },
10912
11209
  {
10913
11210
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
10914
11211
  name: "Jabari",
10915
11212
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10916
- validUntil: null,
10917
11213
  externalId: "yHH9Nz4rLOt"
10918
11214
  },
10919
11215
  {
10920
11216
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
10921
11217
  name: "Kifani",
10922
11218
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10923
- validUntil: null,
10924
11219
  externalId: "eSWmXIGeu1I"
10925
11220
  },
10926
11221
  {
10927
11222
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
10928
11223
  name: "Lumela",
10929
11224
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10930
- validUntil: null,
10931
11225
  externalId: "bh0b3aI1uP3"
10932
11226
  }
10933
11227
  ];
10934
- var V2_DEFAULT_MOCK_LOCATIONS = [
11228
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
11229
+ var MOCK_LOCATIONS_BASE = [
10935
11230
  {
10936
11231
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
10937
11232
  name: "Central Provincial Office",
10938
11233
  locationType: "CRVS_OFFICE",
10939
11234
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10940
- validUntil: null,
10941
11235
  externalId: "Xr3Df8WpK6Ys"
10942
11236
  },
10943
11237
  {
10944
11238
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
10945
11239
  name: "Central Health Post",
10946
11240
  locationType: "HEALTH_FACILITY",
10947
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10948
- validUntil: null
11241
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
10949
11242
  },
10950
11243
  {
10951
11244
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
10952
11245
  name: "Ibombo District Office",
10953
11246
  locationType: "CRVS_OFFICE",
10954
11247
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10955
- validUntil: null,
10956
11248
  externalId: "Sm4Nw7GrD2Vy"
10957
11249
  },
10958
11250
  {
@@ -10960,7 +11252,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
10960
11252
  name: "Isamba District Office",
10961
11253
  locationType: "CRVS_OFFICE",
10962
11254
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10963
- validUntil: null,
10964
11255
  externalId: "Vg1Bq5XeH9Lt"
10965
11256
  },
10966
11257
  {
@@ -10968,7 +11259,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
10968
11259
  name: "Isango District Office",
10969
11260
  locationType: "CRVS_OFFICE",
10970
11261
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
10971
- validUntil: null,
10972
11262
  externalId: "Je7Lm2XqN9Vz"
10973
11263
  },
10974
11264
  {
@@ -10976,7 +11266,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
10976
11266
  name: "Sulaka Provincial Office",
10977
11267
  locationType: "CRVS_OFFICE",
10978
11268
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10979
- validUntil: null,
10980
11269
  externalId: "Ht2Wp9KcX5Qv"
10981
11270
  },
10982
11271
  {
@@ -10984,7 +11273,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
10984
11273
  name: "Ilanga District Office",
10985
11274
  locationType: "CRVS_OFFICE",
10986
11275
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
10987
- validUntil: null,
10988
11276
  externalId: "Yp6Ds1WqN3Xz"
10989
11277
  },
10990
11278
  {
@@ -10992,7 +11280,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
10992
11280
  name: "Chamakubi Health Post",
10993
11281
  locationType: "HEALTH_FACILITY",
10994
11282
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10995
- validUntil: null,
10996
11283
  externalId: "M1nFr8LbC2Qy"
10997
11284
  },
10998
11285
  {
@@ -11000,7 +11287,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11000
11287
  name: "Ibombo Rural Health Centre",
11001
11288
  locationType: "HEALTH_FACILITY",
11002
11289
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11003
- validUntil: null,
11004
11290
  externalId: "bT7pV6YrW0Xc"
11005
11291
  },
11006
11292
  {
@@ -11008,7 +11294,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11008
11294
  name: "Chikobo Rural Health Centre",
11009
11295
  locationType: "HEALTH_FACILITY",
11010
11296
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11011
- validUntil: null,
11012
11297
  externalId: "zE4qPn2SgJ5d"
11013
11298
  },
11014
11299
  {
@@ -11016,7 +11301,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11016
11301
  name: "Chilochabalenje Health Post",
11017
11302
  locationType: "HEALTH_FACILITY",
11018
11303
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11019
- validUntil: null,
11020
11304
  externalId: "H8vDs1MqR4Uf"
11021
11305
  },
11022
11306
  {
@@ -11024,7 +11308,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11024
11308
  name: "Chipeso Rural Health Centre",
11025
11309
  locationType: "HEALTH_FACILITY",
11026
11310
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11027
- validUntil: null,
11028
11311
  externalId: "Qw3uZ9KfX6Lm"
11029
11312
  },
11030
11313
  {
@@ -11032,7 +11315,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11032
11315
  name: "Chisamba Rural Health Centre",
11033
11316
  locationType: "HEALTH_FACILITY",
11034
11317
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11035
- validUntil: null,
11036
11318
  externalId: "Yr0pCg8LdM2s"
11037
11319
  },
11038
11320
  {
@@ -11040,7 +11322,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11040
11322
  name: "Chitanda Rural Health Centre",
11041
11323
  locationType: "HEALTH_FACILITY",
11042
11324
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11043
- validUntil: null,
11044
11325
  externalId: "tS9gJ4PwB1Qx"
11045
11326
  },
11046
11327
  {
@@ -11048,7 +11329,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11048
11329
  name: "Golden Valley Rural Health Centre",
11049
11330
  locationType: "HEALTH_FACILITY",
11050
11331
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11051
- validUntil: null,
11052
11332
  externalId: "Ld7Qm3XsA8Vr"
11053
11333
  },
11054
11334
  {
@@ -11056,7 +11336,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11056
11336
  name: "Ipongo Rural Health Centre",
11057
11337
  locationType: "HEALTH_FACILITY",
11058
11338
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11059
- validUntil: null,
11060
11339
  externalId: "kF2sW9DmH0Bt"
11061
11340
  },
11062
11341
  {
@@ -11064,7 +11343,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11064
11343
  name: "Itumbwe Health Post",
11065
11344
  locationType: "HEALTH_FACILITY",
11066
11345
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11067
- validUntil: null,
11068
11346
  externalId: "Ue5Xb3VaC7Pq"
11069
11347
  },
11070
11348
  {
@@ -11072,7 +11350,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11072
11350
  name: "Kabangalala Rural Health Centre",
11073
11351
  locationType: "HEALTH_FACILITY",
11074
11352
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11075
- validUntil: null,
11076
11353
  externalId: "Pz8Kc1TqH6Jn"
11077
11354
  },
11078
11355
  // Village offices
@@ -11081,13 +11358,61 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11081
11358
  name: "Klow Village Office",
11082
11359
  locationType: "CRVS_OFFICE",
11083
11360
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
11084
- validUntil: null,
11085
11361
  externalId: "PmAyxAJkxiJ"
11086
11362
  }
11087
11363
  ];
11364
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
11088
11365
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
11089
11366
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
11090
11367
  );
11091
11368
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
11092
11369
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
11093
11370
  );
11371
+
11372
+ // ../commons/src/events/locationPayloads.ts
11373
+ var z44 = __toESM(require("zod/v4"));
11374
+ var CreateLocationPayload = z44.object({
11375
+ id: UUID.optional(),
11376
+ versionId: UUID.optional(),
11377
+ name: z44.string(),
11378
+ externalId: z44.string().nullish(),
11379
+ administrativeAreaId: UUID.nullable(),
11380
+ locationType: z44.string().nullable(),
11381
+ effectiveFrom: z44.iso.date().optional(),
11382
+ status: LocationStatus.default("active")
11383
+ });
11384
+ var UpdateLocationPayload = z44.strictObject({
11385
+ id: UUID,
11386
+ versionId: UUID.optional(),
11387
+ name: z44.string(),
11388
+ externalId: z44.string().nullish(),
11389
+ status: LocationStatus,
11390
+ effectiveFrom: z44.iso.date().optional(),
11391
+ lastVersionId: UUID
11392
+ });
11393
+ var WithdrawLocationVersionPayload = z44.object({
11394
+ id: UUID,
11395
+ versionId: UUID
11396
+ });
11397
+ var CreateAdministrativeAreaPayload = z44.object({
11398
+ id: UUID.optional(),
11399
+ versionId: UUID.optional(),
11400
+ name: z44.string(),
11401
+ externalId: z44.string().nullish(),
11402
+ parentId: UUID.nullable(),
11403
+ effectiveFrom: z44.iso.date().optional(),
11404
+ status: LocationStatus.default("active")
11405
+ });
11406
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
11407
+ id: UUID,
11408
+ versionId: UUID.optional(),
11409
+ name: z44.string(),
11410
+ externalId: z44.string().nullish(),
11411
+ status: LocationStatus,
11412
+ effectiveFrom: z44.iso.date().optional(),
11413
+ lastVersionId: UUID
11414
+ });
11415
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
11416
+ id: UUID,
11417
+ versionId: UUID
11418
+ });