@opencrvs/toolkit 2.1.2 → 2.2.0-rc.045257f

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 (144) hide show
  1. package/build.sh +2 -12
  2. package/create-countryconfig/package.json +1 -1
  3. package/dist/application-config/index.js +41 -9
  4. package/dist/authentication/index.d.ts +1 -0
  5. package/dist/authentication/index.js +30 -6
  6. package/dist/cli.js +944 -2044
  7. package/dist/commons/api/router.d.ts +1546 -243
  8. package/dist/commons/application-config/index.d.ts +2 -2
  9. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  10. package/dist/commons/conditionals/index.d.ts +1 -0
  11. package/dist/commons/conditionals/validate.d.ts +5 -0
  12. package/dist/commons/events/ActionConfig.d.ts +146 -20
  13. package/dist/commons/events/ActionDocument.d.ts +89 -0
  14. package/dist/commons/events/ActionInput.d.ts +56 -4
  15. package/dist/commons/events/ActionType.d.ts +11 -1
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
  17. package/dist/commons/events/AuditLog.d.ts +4 -0
  18. package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
  19. package/dist/commons/events/CountryConfigQueryInput.d.ts +192 -18
  20. package/dist/commons/events/Draft.d.ts +2 -0
  21. package/dist/commons/events/EventConfig.d.ts +27 -6
  22. package/dist/commons/events/EventDocument.d.ts +88 -0
  23. package/dist/commons/events/EventIndex.d.ts +43 -6
  24. package/dist/commons/events/EventMetadata.d.ts +23 -1
  25. package/dist/commons/events/EventStatus.d.ts +1 -0
  26. package/dist/commons/events/FieldConfig.d.ts +11 -1
  27. package/dist/commons/events/FieldTypeMapping.d.ts +6 -6
  28. package/dist/commons/events/Flag.d.ts +1 -7
  29. package/dist/commons/events/PlainDate.d.ts +1 -0
  30. package/dist/commons/events/WorkqueueConfig.d.ts +224 -33
  31. package/dist/commons/events/eventConfigValidation.d.ts +26 -1
  32. package/dist/commons/events/index.d.ts +3 -0
  33. package/dist/commons/events/scopes.d.ts +2 -0
  34. package/dist/commons/events/state/flags.d.ts +1 -1
  35. package/dist/commons/events/state/index.d.ts +10 -2
  36. package/dist/commons/events/state/utils.d.ts +11 -1
  37. package/dist/commons/events/test.utils.d.ts +30 -1
  38. package/dist/commons/events/toNotificationForm.d.ts +17 -0
  39. package/dist/commons/events/utils.d.ts +62 -8
  40. package/dist/conditionals/index.js +16 -4
  41. package/dist/environment/derived-variables.d.ts +16 -4
  42. package/dist/environment/derived-variables.d.ts.map +1 -1
  43. package/dist/environment/derived-variables.js +18 -4
  44. package/dist/environment/dockerhub.d.ts +15 -0
  45. package/dist/environment/dockerhub.d.ts.map +1 -0
  46. package/dist/environment/dockerhub.js +104 -0
  47. package/dist/environment/questions.js +1 -1
  48. package/dist/environment/setup-environment.d.ts.map +1 -1
  49. package/dist/environment/setup-environment.js +67 -18
  50. package/dist/environment/templates.d.ts.map +1 -1
  51. package/dist/events/index.js +496 -129
  52. package/dist/migrations/index.d.ts +9 -0
  53. package/dist/migrations/index.d.ts.map +1 -0
  54. package/dist/migrations/index.js +847 -0
  55. package/dist/migrations/move-declaration-to-declare-action.d.ts +38 -0
  56. package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -0
  57. package/dist/migrations/move-declaration-to-declare-action.js +377 -0
  58. package/dist/migrations/{v2.1 → persistent}/add-translations.d.ts +7 -1
  59. package/dist/migrations/persistent/add-translations.d.ts.map +1 -0
  60. package/dist/migrations/{v2.1 → persistent}/add-translations.js +14 -12
  61. package/dist/migrations/persistent/check-upgrade-path.d.ts +36 -0
  62. package/dist/migrations/persistent/check-upgrade-path.d.ts.map +1 -0
  63. package/dist/migrations/persistent/check-upgrade-path.js +105 -0
  64. package/dist/migrations/persistent/update-toolkit-dependency.d.ts +7 -0
  65. package/dist/migrations/persistent/update-toolkit-dependency.d.ts.map +1 -0
  66. package/dist/migrations/persistent/update-toolkit-dependency.js +77 -0
  67. package/dist/migrations/read-declaration-through-helper.d.ts +39 -0
  68. package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -0
  69. package/dist/migrations/read-declaration-through-helper.js +257 -0
  70. package/dist/migrations/replace-incomplete-flag.d.ts +26 -0
  71. package/dist/migrations/replace-incomplete-flag.d.ts.map +1 -0
  72. package/dist/migrations/replace-incomplete-flag.js +126 -0
  73. package/dist/notification/index.js +390 -106
  74. package/dist/scopes/index.d.ts +83 -90
  75. package/dist/scopes/index.js +26 -6
  76. package/dist/templates/charts-values/dependencies/values.yaml +1 -1
  77. package/dist/templates/charts-values/opencrvs-services/values.yaml +3 -5
  78. package/dist/templates/charts-values/traefik/values.yaml +4 -3
  79. package/opencrvs-toolkit-2.2.0-rc.045257f.tgz +0 -0
  80. package/package.json +2 -2
  81. package/tsconfig.build.tsbuildinfo +1 -1
  82. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
  83. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
  84. package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
  85. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +0 -3
  86. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +0 -1
  87. package/dist/migrations/v2.1/add-recovery-link-notifications.js +0 -511
  88. package/dist/migrations/v2.1/add-translations.d.ts.map +0 -1
  89. package/dist/migrations/v2.1/enable-telemetry.d.ts +0 -3
  90. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +0 -1
  91. package/dist/migrations/v2.1/enable-telemetry.js +0 -455
  92. package/dist/migrations/v2.1/index.d.ts +0 -6
  93. package/dist/migrations/v2.1/index.d.ts.map +0 -1
  94. package/dist/migrations/v2.1/index.js +0 -2170
  95. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +0 -14
  96. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +0 -1
  97. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +0 -348
  98. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +0 -2
  99. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +0 -1
  100. package/dist/migrations/v2.1/remove-metabase-package-installs.js +0 -161
  101. package/dist/migrations/v2.1/remove-sentry.d.ts +0 -3
  102. package/dist/migrations/v2.1/remove-sentry.d.ts.map +0 -1
  103. package/dist/migrations/v2.1/remove-sentry.js +0 -354
  104. package/dist/migrations/v2.1/rename-trigger-paths.d.ts +0 -3
  105. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +0 -1
  106. package/dist/migrations/v2.1/rename-trigger-paths.js +0 -216
  107. package/dist/migrations/v2.1/template-files.d.ts +0 -8
  108. package/dist/migrations/v2.1/template-files.d.ts.map +0 -1
  109. package/dist/migrations/v2.1/template-files.js +0 -49
  110. package/dist/migrations/v2.1/upgrade-tilt.d.ts +0 -8
  111. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +0 -1
  112. package/dist/migrations/v2.1/upgrade-tilt.js +0 -139
  113. package/dist/templates/countryconfig-template/.tiltignore +0 -1
  114. package/dist/templates/countryconfig-template/Dockerfile.assets +0 -7
  115. package/dist/templates/countryconfig-template/Tiltfile +0 -112
  116. package/dist/templates/countryconfig-template/assets/README.md +0 -1
  117. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +0 -61
  118. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +0 -455
  119. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +0 -168
  120. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +0 -67
  121. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +0 -168
  122. package/dist/templates/countryconfig-template/assets/metabase/README.md +0 -34
  123. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +0 -36
  124. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +0 -46
  125. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +0 -27737
  126. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +0 -21
  127. package/dist/templates/countryconfig-template/assets/metabase/package.json +0 -13
  128. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +0 -108
  129. package/dist/templates/countryconfig-template/assets/metabase/run.sh +0 -120
  130. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +0 -40
  131. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +0 -135
  132. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +0 -108
  133. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +0 -50
  134. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +0 -35
  135. package/dist/templates/countryconfig-template/tilt/common.tilt +0 -145
  136. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +0 -15
  137. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +0 -56
  138. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +0 -21
  139. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +0 -38
  140. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +0 -17
  141. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +0 -16
  142. package/dist/templates/countryconfig-template/tilt/lib.tilt +0 -95
  143. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +0 -136
  144. package/opencrvs-toolkit-2.1.2.tgz +0 -0
@@ -180,6 +180,7 @@ __export(events_exports, {
180
180
  NameFieldUpdateValue: () => NameFieldUpdateValue,
181
181
  NameFieldValue: () => NameFieldValue,
182
182
  NonEmptyTextValue: () => NonEmptyTextValue,
183
+ NoneOfStatus: () => NoneOfStatus,
183
184
  NotifyActionInput: () => NotifyActionInput,
184
185
  NumberFieldValue: () => NumberFieldValue,
185
186
  NumberWithUnitFieldUpdateValue: () => NumberWithUnitFieldUpdateValue,
@@ -203,10 +204,12 @@ __export(events_exports, {
203
204
  RegisterAction: () => RegisterAction,
204
205
  RegisterActionInput: () => RegisterActionInput,
205
206
  RegistrationCreationMetadata: () => RegistrationCreationMetadata,
207
+ ReinstateRegistrationActionInput: () => ReinstateRegistrationActionInput,
206
208
  RejectCorrectionActionInput: () => RejectCorrectionActionInput,
207
209
  RejectDeclarationActionInput: () => RejectDeclarationActionInput,
208
210
  RejectedCorrectionAction: () => RejectedCorrectionAction,
209
211
  RequestCorrectionActionInput: () => RequestCorrectionActionInput,
212
+ RevokeRegistrationActionInput: () => RevokeRegistrationActionInput,
210
213
  SearchQuery: () => SearchQuery,
211
214
  SearchQueryParams: () => SearchQueryParams,
212
215
  SeededLocationVersions: () => SeededLocationVersions,
@@ -336,6 +339,7 @@ __export(events_exports, {
336
339
  getActionAnnotation: () => getActionAnnotation,
337
340
  getActionAnnotationFields: () => getActionAnnotationFields,
338
341
  getActionConfig: () => getActionConfig,
342
+ getActionForm: () => getActionForm,
339
343
  getActionFormFields: () => getActionFormFields,
340
344
  getActionReview: () => getActionReview,
341
345
  getActionReviewFields: () => getActionReviewFields,
@@ -364,6 +368,8 @@ __export(events_exports, {
364
368
  getLeafAdministrativeAreaIds: () => getLeafAdministrativeAreaIds,
365
369
  getLocationHierarchy: () => getLocationHierarchy,
366
370
  getMixedPath: () => getMixedPath,
371
+ getNotificationFields: () => getNotificationFields,
372
+ getNotificationForm: () => getNotificationForm,
367
373
  getPendingAction: () => getPendingAction,
368
374
  getPrintCertificatePages: () => getPrintCertificatePages,
369
375
  getRandomDate: () => getRandomDate,
@@ -374,10 +380,12 @@ __export(events_exports, {
374
380
  hasAnyOfScopes: () => hasAnyOfScopes,
375
381
  isActionAvailable: () => isActionAvailable,
376
382
  isActionConfigType: () => isActionConfigType,
383
+ isActionDocument: () => isActionDocument,
377
384
  isActionEnabled: () => isActionEnabled,
378
385
  isActionInScope: () => isActionInScope,
379
386
  isActionVisible: () => isActionVisible,
380
387
  isAddressFieldType: () => isAddressFieldType,
388
+ isAddressFieldValue: () => isAddressFieldValue,
381
389
  isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
382
390
  isAgeFieldType: () => isAgeFieldType,
383
391
  isAutocompleteFieldType: () => isAutocompleteFieldType,
@@ -392,6 +400,7 @@ __export(events_exports, {
392
400
  isDateFieldType: () => isDateFieldType,
393
401
  isDateRangeFieldType: () => isDateRangeFieldType,
394
402
  isDividerFieldType: () => isDividerFieldType,
403
+ isDomesticAddressFieldValue: () => isDomesticAddressFieldValue,
395
404
  isEmailFieldType: () => isEmailFieldType,
396
405
  isEventFieldReference: () => isEventFieldReference,
397
406
  isFacilityFieldType: () => isFacilityFieldType,
@@ -405,7 +414,9 @@ __export(events_exports, {
405
414
  isFieldValueWithoutTemplates: () => isFieldValueWithoutTemplates,
406
415
  isFieldVisible: () => isFieldVisible,
407
416
  isFileFieldType: () => isFileFieldType,
417
+ isFileFieldValue: () => isFileFieldValue,
408
418
  isFileFieldWithOptionType: () => isFileFieldWithOptionType,
419
+ isFileFieldWithOptionValue: () => isFileFieldWithOptionValue,
409
420
  isHeadingFieldType: () => isHeadingFieldType,
410
421
  isHiddenFieldType: () => isHiddenFieldType,
411
422
  isHttpFieldType: () => isHttpFieldType,
@@ -426,6 +437,7 @@ __export(events_exports, {
426
437
  isPageVisible: () => isPageVisible,
427
438
  isParagraphFieldType: () => isParagraphFieldType,
428
439
  isPhoneFieldType: () => isPhoneFieldType,
440
+ isPlainDate: () => isPlainDate,
429
441
  isPotentialDuplicate: () => isPotentialDuplicate,
430
442
  isPrintButtonFieldType: () => isPrintButtonFieldType,
431
443
  isQrReaderFieldType: () => isQrReaderFieldType,
@@ -474,6 +486,8 @@ __export(events_exports, {
474
486
  timePeriodToDateRange: () => timePeriodToDateRange,
475
487
  toClientAdministrativeArea: () => toClientAdministrativeArea,
476
488
  toClientLocation: () => toClientLocation,
489
+ toNotificationForm: () => toNotificationForm,
490
+ toNotificationReview: () => toNotificationReview,
477
491
  toPlainDate: () => toPlainDate,
478
492
  todayISO: () => todayISO,
479
493
  user: () => user,
@@ -482,10 +496,14 @@ __export(events_exports, {
482
496
  validateFieldInput: () => validateFieldInput,
483
497
  validateValue: () => validateValue,
484
498
  window: () => window2,
499
+ withDeclaration: () => withDeclaration,
485
500
  writeActions: () => writeActions
486
501
  });
487
502
  module.exports = __toCommonJS(events_exports);
488
503
 
504
+ // ../commons/src/events/index.ts
505
+ var import_compile = require("zod/compile");
506
+
489
507
  // ../commons/src/events/AuditLog.ts
490
508
  var z9 = __toESM(require("zod/v4"));
491
509
 
@@ -504,6 +522,12 @@ var UUID = z.uuid().brand("UUID");
504
522
  function getUUID() {
505
523
  return (0, import_uuid.v4)();
506
524
  }
525
+ function isUUID(id) {
526
+ return UUID.validate(id);
527
+ }
528
+ function maybeUuid(value) {
529
+ return isUUID(value) ? value : void 0;
530
+ }
507
531
 
508
532
  // ../commons/src/events/ActionType.ts
509
533
  var z2 = __toESM(require("zod/v4"));
@@ -529,6 +553,8 @@ var ActionType = {
529
553
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
530
554
  REJECT_CORRECTION: "REJECT_CORRECTION",
531
555
  APPROVE_CORRECTION: "APPROVE_CORRECTION",
556
+ REVOKE_REGISTRATION: "REVOKE_REGISTRATION",
557
+ REINSTATE_REGISTRATION: "REINSTATE_REGISTRATION",
532
558
  // General actions
533
559
  READ: "READ",
534
560
  ASSIGN: "ASSIGN",
@@ -548,6 +574,8 @@ var ConfirmableActions = [
548
574
  ActionType.REQUEST_CORRECTION,
549
575
  ActionType.APPROVE_CORRECTION,
550
576
  ActionType.REJECT_CORRECTION,
577
+ ActionType.REVOKE_REGISTRATION,
578
+ ActionType.REINSTATE_REGISTRATION,
551
579
  ActionType.CUSTOM
552
580
  ];
553
581
  var ActionTypes = z2.enum([
@@ -567,6 +595,8 @@ var ActionTypes = z2.enum([
567
595
  "REQUEST_CORRECTION",
568
596
  "REJECT_CORRECTION",
569
597
  "APPROVE_CORRECTION",
598
+ "REVOKE_REGISTRATION",
599
+ "REINSTATE_REGISTRATION",
570
600
  "READ",
571
601
  "ASSIGN",
572
602
  "UNASSIGN",
@@ -608,7 +638,9 @@ var WorkqueueActionType = ActionTypes.extract([
608
638
  ActionType.ARCHIVE,
609
639
  ActionType.UNARCHIVE,
610
640
  ActionType.PRINT_CERTIFICATE,
611
- ActionType.REQUEST_CORRECTION
641
+ ActionType.REQUEST_CORRECTION,
642
+ ActionType.REVOKE_REGISTRATION,
643
+ ActionType.REINSTATE_REGISTRATION
612
644
  ]);
613
645
  var META_ACTIONS = [
614
646
  ActionType.ASSIGN,
@@ -627,7 +659,7 @@ var ActionStatus = {
627
659
  };
628
660
 
629
661
  // ../commons/src/events/Flag.ts
630
- var z5 = __toESM(require("zod/v4"));
662
+ var z5 = __toESM(require("zod"));
631
663
 
632
664
  // ../commons/src/events/TranslationConfig.ts
633
665
  var z3 = __toESM(require("zod/v4"));
@@ -696,7 +728,6 @@ var FieldConditional = z4.discriminatedUnion("type", [
696
728
 
697
729
  // ../commons/src/events/Flag.ts
698
730
  var InherentFlags = {
699
- INCOMPLETE: "incomplete",
700
731
  REJECTED: "rejected",
701
732
  CORRECTION_REQUESTED: "correction-requested",
702
733
  POTENTIAL_DUPLICATE: "potential-duplicate",
@@ -724,7 +755,7 @@ var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).inclu
724
755
  message: `Custom flag cannot be one of the inherent flags: ${Object.values(
725
756
  InherentFlags
726
757
  ).join(", ")}`
727
- }).refine((val) => !ActionFlag.safeParse(val).success, {
758
+ }).refine((val) => !ActionFlag.validate(val), {
728
759
  message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
729
760
  }).describe("Custom flag identifier defined by the country config.");
730
761
  var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
@@ -763,6 +794,7 @@ var EventStatus = z6.enum([
763
794
  "NOTIFIED",
764
795
  "DECLARED",
765
796
  "REGISTERED",
797
+ "REVOKED",
766
798
  "ARCHIVED"
767
799
  ]);
768
800
 
@@ -786,6 +818,8 @@ var RecordScopeTypeV2 = z7.enum([
786
818
  "record.print-certified-copies",
787
819
  "record.request-correction",
788
820
  "record.correct",
821
+ "record.revoke-registration",
822
+ "record.reinstate-registration",
789
823
  "record.unassign-others",
790
824
  "record.custom-action",
791
825
  "record.action.accept",
@@ -912,6 +946,8 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
912
946
  "record.read",
913
947
  "record.request-correction",
914
948
  "record.correct",
949
+ "record.revoke-registration",
950
+ "record.reinstate-registration",
915
951
  "record.unassign-others",
916
952
  "record.review-duplicates"
917
953
  ]);
@@ -1156,6 +1192,8 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
1156
1192
  "event.actions.correction.request.request",
1157
1193
  "event.actions.correction.approve.request",
1158
1194
  "event.actions.correction.reject.request",
1195
+ "event.actions.revoke_registration.request",
1196
+ "event.actions.reinstate_registration.request",
1159
1197
  "event.actions.mark_as_duplicate.request",
1160
1198
  "event.actions.mark_as_not_duplicate.request"
1161
1199
  ]),
@@ -1490,7 +1528,7 @@ var z14 = __toESM(require("zod/v4"));
1490
1528
  // ../commons/src/documents.ts
1491
1529
  var z11 = __toESM(require("zod/v4"));
1492
1530
  var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
1493
- "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
1531
+ "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://s3.opencrvs.com/bucket-name/document-id.jpg"
1494
1532
  );
1495
1533
  var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
1496
1534
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
@@ -1500,7 +1538,7 @@ var DocumentPath = z11.string().brand("DocumentPath").describe(
1500
1538
  );
1501
1539
 
1502
1540
  // ../commons/src/events/CompositeFieldValue.ts
1503
- var z12 = __toESM(require("zod/v4"));
1541
+ var z12 = __toESM(require("zod"));
1504
1542
  var GeographicalArea = {
1505
1543
  URBAN: "URBAN",
1506
1544
  RURAL: "RURAL"
@@ -1514,6 +1552,9 @@ var FileFieldValue = z12.object({
1514
1552
  originalFilename: z12.string(),
1515
1553
  type: z12.string()
1516
1554
  });
1555
+ function isFileFieldValue(value) {
1556
+ return FileFieldValue.validate(value);
1557
+ }
1517
1558
  var NameFieldValue = z12.object({
1518
1559
  firstname: z12.string(),
1519
1560
  surname: z12.string(),
@@ -1538,6 +1579,9 @@ var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
1538
1579
  addressType: z12.literal(AddressType.DOMESTIC),
1539
1580
  administrativeArea: z12.string().uuid()
1540
1581
  });
1582
+ function isDomesticAddressFieldValue(value) {
1583
+ return DomesticAddressFieldValue.validate(value);
1584
+ }
1541
1585
  var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
1542
1586
  addressType: z12.literal(AddressType.INTERNATIONAL)
1543
1587
  });
@@ -1545,6 +1589,9 @@ var AddressFieldValue = z12.discriminatedUnion("addressType", [
1545
1589
  DomesticAddressFieldValue,
1546
1590
  InternationalAddressFieldValue
1547
1591
  ]);
1592
+ function isAddressFieldValue(value) {
1593
+ return AddressFieldValue.validate(value);
1594
+ }
1548
1595
  var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
1549
1596
  addressType: z12.literal(AddressType.DOMESTIC),
1550
1597
  administrativeArea: z12.string().uuid().nullish()
@@ -1566,6 +1613,9 @@ var FileFieldValueWithOption = z12.object({
1566
1613
  option: z12.string()
1567
1614
  });
1568
1615
  var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
1616
+ function isFileFieldWithOptionValue(value) {
1617
+ return FileFieldWithOptionValue.validate(value);
1618
+ }
1569
1619
  var HttpFieldValue = z12.object({
1570
1620
  loading: z12.boolean(),
1571
1621
  error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
@@ -1601,6 +1651,7 @@ var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
1601
1651
  // ../commons/src/events/PlainDate.ts
1602
1652
  var import_zod = require("zod");
1603
1653
  var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
1654
+ var isPlainDate = (date) => PlainDate.validate(date);
1604
1655
  function toPlainDate(dateTime) {
1605
1656
  return dateTime.split("T")[0];
1606
1657
  }
@@ -1716,7 +1767,7 @@ function safeUnion(schemas) {
1716
1767
  );
1717
1768
  return z14.any().superRefine((val, ctx) => {
1718
1769
  for (const schema of sortedSchemas) {
1719
- if (schema.safeParse(val).success) {
1770
+ if (schema.validate(val)) {
1720
1771
  return;
1721
1772
  }
1722
1773
  }
@@ -1910,6 +1961,16 @@ var UnarchiveAction = ActionBase.extend(
1910
1961
  type: z16.literal(ActionType.UNARCHIVE)
1911
1962
  }).shape
1912
1963
  );
1964
+ var RevokeRegistrationAction = ActionBase.extend(
1965
+ z16.object({
1966
+ type: z16.literal(ActionType.REVOKE_REGISTRATION)
1967
+ }).shape
1968
+ );
1969
+ var ReinstateRegistrationAction = ActionBase.extend(
1970
+ z16.object({
1971
+ type: z16.literal(ActionType.REINSTATE_REGISTRATION)
1972
+ }).shape
1973
+ );
1913
1974
  var CreatedAction = ActionBase.extend(
1914
1975
  z16.object({
1915
1976
  type: z16.literal(ActionType.CREATE)
@@ -1978,6 +2039,8 @@ var ActionDocument = z16.discriminatedUnion("type", [
1978
2039
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1979
2040
  ArchiveAction.meta({ id: "ArchiveAction" }),
1980
2041
  UnarchiveAction.meta({ id: "UnarchiveAction" }),
2042
+ RevokeRegistrationAction.meta({ id: "RevokeRegistrationAction" }),
2043
+ ReinstateRegistrationAction.meta({ id: "ReinstateRegistrationAction" }),
1981
2044
  NotifiedAction.meta({ id: "NotifiedAction" }),
1982
2045
  RegisterAction.meta({ id: "RegisterAction" }),
1983
2046
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1993,6 +2056,7 @@ var ActionDocument = z16.discriminatedUnion("type", [
1993
2056
  ]).meta({
1994
2057
  id: "ActionDocument"
1995
2058
  });
2059
+ var isActionDocument = (a) => ActionDocument.validate(a);
1996
2060
  var AsyncRejectActionDocument = ActionBase.omit({
1997
2061
  declaration: true,
1998
2062
  annotation: true
@@ -2026,7 +2090,8 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
2026
2090
  var LegalStatuses = z17.object({
2027
2091
  [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
2028
2092
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
2029
- [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
2093
+ [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish(),
2094
+ [EventStatus.enum.REVOKED]: ActionCreationMetadata.nullish()
2030
2095
  });
2031
2096
  var EventMetadata = z17.object({
2032
2097
  id: UUID,
@@ -2228,6 +2293,12 @@ var AnyOfStatus = import_v4.z.object({
2228
2293
  }).meta({
2229
2294
  id: "AnyOfStatus"
2230
2295
  });
2296
+ var NoneOfStatus = import_v4.z.object({
2297
+ type: import_v4.z.literal("noneOf"),
2298
+ terms: import_v4.z.array(EventStatus)
2299
+ }).meta({
2300
+ id: "NoneOfStatus"
2301
+ });
2231
2302
  var Range = import_v4.z.object({
2232
2303
  type: import_v4.z.literal("range"),
2233
2304
  gte: import_v4.z.string(),
@@ -2268,7 +2339,7 @@ var QueryInput = import_v4.z.lazy(
2268
2339
  var QueryExpression = import_v4.z.object({
2269
2340
  id: import_v4.z.optional(import_v4.z.string()),
2270
2341
  eventType: import_v4.z.string(),
2271
- status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
2342
+ status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
2272
2343
  createdAt: import_v4.z.optional(DateCondition),
2273
2344
  updatedAt: import_v4.z.optional(DateCondition),
2274
2345
  "legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(Within).nullable(),
@@ -2277,6 +2348,7 @@ var QueryExpression = import_v4.z.object({
2277
2348
  "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
2278
2349
  "legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
2279
2350
  "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
2351
+ "legalStatuses.REVOKED.createdAtLocation": import_v4.z.optional(Within).nullable(),
2280
2352
  createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
2281
2353
  updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
2282
2354
  assignedTo: import_v4.z.optional(Exact),
@@ -3477,6 +3549,12 @@ var ReadActionConfig = ActionConfigBase.extend(
3477
3549
  var NotifyConfig = ActionConfigBase.extend(
3478
3550
  z25.object({
3479
3551
  type: z25.literal(ActionType.NOTIFY),
3552
+ notificationForm: DeclarationFormConfig.describe(
3553
+ "Notification form configuration. Its fields must be a subset of the declaration form fields, with matching types. The values submitted on the notification form pre-fill the declaration."
3554
+ ),
3555
+ review: DeclarationReviewConfig.describe(
3556
+ "Review page configuration for the notify action. Values of its fields are stored as the NOTIFY action annotation."
3557
+ ),
3480
3558
  form: actionConfirmationForm
3481
3559
  }).shape
3482
3560
  );
@@ -3529,6 +3607,9 @@ var DeleteConfig = ActionConfigBase.extend(
3529
3607
  var DeclareConfig = DeclarationActionBase.extend(
3530
3608
  z25.object({
3531
3609
  type: z25.literal(ActionType.DECLARE),
3610
+ declaration: DeclarationFormConfig.describe(
3611
+ "Configuration of the form used to gather event data."
3612
+ ),
3532
3613
  review: DeclarationReviewConfig.describe(
3533
3614
  "Configuration of the review page fields."
3534
3615
  ),
@@ -3557,6 +3638,18 @@ var UnarchiveConfig = ActionConfigBase.extend(
3557
3638
  type: z25.literal(ActionType.UNARCHIVE)
3558
3639
  }).shape
3559
3640
  );
3641
+ var RevokeRegistrationConfig = ActionConfigBase.extend(
3642
+ z25.object({
3643
+ type: z25.literal(ActionType.REVOKE_REGISTRATION),
3644
+ form: actionConfirmationForm
3645
+ }).shape
3646
+ );
3647
+ var ReinstateRegistrationConfig = ActionConfigBase.extend(
3648
+ z25.object({
3649
+ type: z25.literal(ActionType.REINSTATE_REGISTRATION),
3650
+ form: actionConfirmationForm
3651
+ }).shape
3652
+ );
3560
3653
  var EditActionConfig = ActionConfigBase.extend(
3561
3654
  z25.object({
3562
3655
  type: z25.literal(ActionType.EDIT),
@@ -3643,11 +3736,11 @@ var ActionConfig = z25.discriminatedUnion("type", [
3643
3736
  }),
3644
3737
  NotifyConfig.meta({
3645
3738
  id: "NotifyActionConfig",
3646
- description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
3739
+ description: "Configuration for the notify action, including the notification form and its review page. When undefined, it is generated using the DeclareActionConfig."
3647
3740
  }),
3648
3741
  DeclareConfig.meta({
3649
3742
  id: "DeclareActionConfig",
3650
- description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3743
+ description: "Configuration for the declare action. Includes the declaration form and review-page fields."
3651
3744
  }),
3652
3745
  DuplicateDetectedConfig.meta({
3653
3746
  id: "DuplicateDetectedActionConfig",
@@ -3697,6 +3790,14 @@ var ActionConfig = z25.discriminatedUnion("type", [
3697
3790
  id: "UnarchiveActionConfig",
3698
3791
  description: "Configuration for unarchiving a record."
3699
3792
  }),
3793
+ RevokeRegistrationConfig.meta({
3794
+ id: "RevokeRegistrationActionConfig",
3795
+ description: "Configuration for revoking a registered record."
3796
+ }),
3797
+ ReinstateRegistrationConfig.meta({
3798
+ id: "ReinstateRegistrationActionConfig",
3799
+ description: "Configuration for reinstating a revoked record back to registered."
3800
+ }),
3700
3801
  CustomActionConfig.meta({
3701
3802
  id: "CustomActionConfig",
3702
3803
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -4508,6 +4609,8 @@ var updateActions = new Set(
4508
4609
  ActionType.REQUEST_CORRECTION,
4509
4610
  ActionType.APPROVE_CORRECTION,
4510
4611
  ActionType.REJECT_CORRECTION,
4612
+ ActionType.REVOKE_REGISTRATION,
4613
+ ActionType.REINSTATE_REGISTRATION,
4511
4614
  ActionType.CUSTOM
4512
4615
  ]).options
4513
4616
  );
@@ -4534,7 +4637,7 @@ function getActionUpdateMetadata(actions) {
4534
4637
  (0, import_lodash.pick)(createAction, metadataFields)
4535
4638
  );
4536
4639
  }
4537
- function getLegalStatuses(actions) {
4640
+ function getLegalStatuses(actions, status2) {
4538
4641
  return {
4539
4642
  [EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
4540
4643
  ActionType.NOTIFY,
@@ -4547,7 +4650,12 @@ function getLegalStatuses(actions) {
4547
4650
  [EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
4548
4651
  ActionType.REGISTER,
4549
4652
  actions
4550
- )
4653
+ ),
4654
+ // A later reinstate does not remove the revoke action, so only report it while the record is still revoked.
4655
+ [EventStatus.enum.REVOKED]: status2 === EventStatus.enum.REVOKED ? getDeclarationActionCreationMetadata(
4656
+ ActionType.REVOKE_REGISTRATION,
4657
+ actions
4658
+ ) : null
4551
4659
  };
4552
4660
  }
4553
4661
 
@@ -4624,15 +4732,6 @@ var INHERENT_FLAG_RULES = [
4624
4732
  setOn: [ActionType.REQUEST_CORRECTION],
4625
4733
  resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4626
4734
  },
4627
- {
4628
- // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4629
- // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
4630
- // are deliberately excluded so the flag freezes across an archive/unarchive
4631
- // round trip and comes back exactly as it was.
4632
- flag: InherentFlags.INCOMPLETE,
4633
- setOn: [ActionType.NOTIFY],
4634
- resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4635
- },
4636
4735
  {
4637
4736
  flag: InherentFlags.REJECTED,
4638
4737
  setOn: [ActionType.REJECT],
@@ -5417,6 +5516,10 @@ function getStatusFromActions(actions) {
5417
5516
  return EventStatus.enum.REGISTERED;
5418
5517
  case ActionType.NOTIFY:
5419
5518
  return EventStatus.enum.NOTIFIED;
5519
+ case ActionType.REVOKE_REGISTRATION:
5520
+ return EventStatus.enum.REVOKED;
5521
+ case ActionType.REINSTATE_REGISTRATION:
5522
+ return EventStatus.enum.REGISTERED;
5420
5523
  // Already filtered out above; listed here only to satisfy exhaustiveness.
5421
5524
  case ActionType.ARCHIVE:
5422
5525
  case ActionType.UNARCHIVE:
@@ -5476,35 +5579,24 @@ function resolveDateOfEvent(eventIndex, declaration, config) {
5476
5579
  if (!config.dateOfEvent) {
5477
5580
  return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
5478
5581
  }
5479
- const parsedDate = isFieldReference(config.dateOfEvent) ? ZodDate.safeParse(declaration[config.dateOfEvent.$$field]) : ZodDateTime.safeParse(
5480
- getMixedPath(eventIndex, config.dateOfEvent.$$event)
5582
+ if (isFieldReference(config.dateOfEvent)) {
5583
+ const fieldDate = declaration[config.dateOfEvent.$$field];
5584
+ return ZodDate.validate(fieldDate) ? extractDateString(fieldDate) : void 0;
5585
+ }
5586
+ const eventDate = getMixedPath(
5587
+ eventIndex,
5588
+ config.dateOfEvent.$$event
5481
5589
  );
5482
- return parsedDate.success ? extractDateString(parsedDate.data) : void 0;
5590
+ return ZodDateTime.validate(eventDate) ? extractDateString(eventDate) : void 0;
5483
5591
  }
5484
5592
  var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
5485
- function getParsedUUID(value, oldValue) {
5486
- const parsed = UUID.safeParse(value);
5487
- return parsed.success ? parsed.data : oldValue;
5488
- }
5489
5593
  function resolvePlaceOfEvent(eventMetadata, declaration, config) {
5490
- let placeOfEvent = getParsedUUID(
5594
+ let placeOfEvent = maybeUuid(
5491
5595
  eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
5492
5596
  );
5493
5597
  if (config.placeOfEvent) {
5494
- const addressFieldValue = AddressFieldValue.safeParse(
5495
- declaration[config.placeOfEvent.$$field]
5496
- );
5497
- if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
5498
- placeOfEvent = getParsedUUID(
5499
- addressFieldValue.data.administrativeArea,
5500
- placeOfEvent
5501
- );
5502
- } else {
5503
- placeOfEvent = getParsedUUID(
5504
- declaration[config.placeOfEvent.$$field],
5505
- placeOfEvent
5506
- );
5507
- }
5598
+ const addressFieldValue = declaration[config.placeOfEvent.$$field];
5599
+ placeOfEvent = isDomesticAddressFieldValue(addressFieldValue) ? maybeUuid(addressFieldValue.administrativeArea) ?? placeOfEvent : maybeUuid(declaration[config.placeOfEvent.$$field]) ?? placeOfEvent;
5508
5600
  }
5509
5601
  return placeOfEvent;
5510
5602
  }
@@ -5534,7 +5626,7 @@ function getCurrentEventState(event2, config) {
5534
5626
  const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
5535
5627
  const declaration = aggregateActionDeclarations(event2);
5536
5628
  const status2 = getStatusFromActions(sortedActions);
5537
- const legalStatuses = getLegalStatuses(sortedActions);
5629
+ const legalStatuses = getLegalStatuses(sortedActions, status2);
5538
5630
  const base = deepDropNulls({
5539
5631
  id: event2.id,
5540
5632
  type: event2.type,
@@ -5789,7 +5881,7 @@ function precompileActionSchemas(eventConfigurations) {
5789
5881
  }
5790
5882
  }
5791
5883
  function isAgeValue(value) {
5792
- return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
5884
+ return AgeValue.validate(value);
5793
5885
  }
5794
5886
  function mergeWithBaseFormState(values, context) {
5795
5887
  return { ...context.baseFormState, ...values };
@@ -5819,15 +5911,13 @@ function validate(schema, data) {
5819
5911
  return [key, value];
5820
5912
  }
5821
5913
  const age = value.age;
5822
- const maybeAsOfDate = PlainDate.safeParse(data.$form[value.asOfDateRef]);
5914
+ const asOf = data.$form[value.asOfDateRef];
5915
+ const asOfDate = isPlainDate(asOf) ? asOf : PlainDate.parse(data.$now);
5823
5916
  return [
5824
5917
  key,
5825
5918
  {
5826
5919
  age,
5827
- dob: ageToDate(
5828
- age,
5829
- maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
5830
- )
5920
+ dob: ageToDate(age, asOfDate)
5831
5921
  }
5832
5922
  ];
5833
5923
  });
@@ -5990,6 +6080,11 @@ var errorMessages = {
5990
6080
  description: "Error message when field is not expected",
5991
6081
  id: "error.unexpectedField"
5992
6082
  },
6083
+ notInNotifyForm: {
6084
+ defaultMessage: "Field is not part of the notify form. Notify-only data belongs in annotation",
6085
+ description: "Error message when a notify declaration contains a field outside the notify form",
6086
+ id: "error.notInNotifyForm"
6087
+ },
5993
6088
  correctionNotAllowed: {
5994
6089
  defaultMessage: "Correction not allowed for field",
5995
6090
  description: "Error message when correction is not allowed for field",
@@ -6209,14 +6304,45 @@ function ageToDate(age, asOfDate) {
6209
6304
  const date = plainDateToLocalDate(asOfDate);
6210
6305
  return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
6211
6306
  }
6212
- function getDeclarationFields(configuration) {
6213
- return configuration.declaration.pages.flatMap(({ fields }) => fields);
6307
+ function getDeclaration(configuration) {
6308
+ const declareAction = configuration.actions.find(
6309
+ (action) => action.type === ActionType.DECLARE
6310
+ );
6311
+ if (!declareAction) {
6312
+ throw new Error(
6313
+ `Event '${configuration.id}' has no ${ActionType.DECLARE} action to read the declaration from`
6314
+ );
6315
+ }
6316
+ return declareAction.declaration;
6214
6317
  }
6215
6318
  function getDeclarationPages(configuration) {
6216
- return configuration.declaration.pages;
6319
+ return getDeclaration(configuration).pages;
6217
6320
  }
6218
- function getDeclaration(configuration) {
6219
- return configuration.declaration;
6321
+ function getDeclarationFields(configuration) {
6322
+ return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
6323
+ }
6324
+ function getConfiguredNotificationForm(configuration) {
6325
+ const notifyAction = configuration.actions.find(
6326
+ (action) => action.type === ActionType.NOTIFY
6327
+ );
6328
+ return notifyAction?.type === ActionType.NOTIFY ? notifyAction.notificationForm : void 0;
6329
+ }
6330
+ function getNotificationForm(configuration) {
6331
+ const notificationForm = getConfiguredNotificationForm(configuration);
6332
+ if (!notificationForm) {
6333
+ throw new Error(
6334
+ `Event '${configuration.id}' has no ${ActionType.NOTIFY} action.`
6335
+ );
6336
+ }
6337
+ return notificationForm;
6338
+ }
6339
+ function getNotificationFields(configuration) {
6340
+ return getNotificationForm(configuration).pages.flatMap(
6341
+ ({ fields }) => fields
6342
+ );
6343
+ }
6344
+ function getActionForm(configuration, actionType) {
6345
+ return actionType === ActionType.NOTIFY ? getNotificationForm(configuration) : getDeclaration(configuration);
6220
6346
  }
6221
6347
  function isActionConfigType(type) {
6222
6348
  return actionConfigTypes.has(type);
@@ -6226,9 +6352,6 @@ function getActionConfig({
6226
6352
  actionType,
6227
6353
  customActionType
6228
6354
  }) {
6229
- if (actionType === ActionType.NOTIFY) {
6230
- return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
6231
- }
6232
6355
  return eventConfiguration.actions.find((a) => {
6233
6356
  if (a.type === ActionType.CUSTOM && customActionType) {
6234
6357
  return a.customActionType === customActionType;
@@ -6476,11 +6599,14 @@ function flattenFieldReference(ref) {
6476
6599
  return [ref.$$field, ...ref.$$subfield];
6477
6600
  }
6478
6601
  function isWriteAction(actionType) {
6479
- return writeActions.safeParse(actionType).success;
6602
+ return writeActions.validate(actionType);
6480
6603
  }
6481
6604
  var findAllFields = (config) => {
6482
6605
  return (0, import_lodash4.flattenDeep)([
6483
6606
  ...getDeclarationFields(config),
6607
+ ...getConfiguredNotificationForm(config)?.pages.flatMap(
6608
+ ({ fields }) => fields
6609
+ ) ?? [],
6484
6610
  ...getAllAnnotationFields(config)
6485
6611
  ]);
6486
6612
  };
@@ -6837,6 +6963,87 @@ function validateActionOrder(event2, ctx) {
6837
6963
  }
6838
6964
  }
6839
6965
  }
6966
+ function validateExactlyOneDeclareAction(event2, ctx) {
6967
+ const declareActionCount = event2.actions.filter(
6968
+ (action) => action.type === ActionType.DECLARE
6969
+ ).length;
6970
+ if (declareActionCount !== 1) {
6971
+ ctx.addIssue({
6972
+ code: "custom",
6973
+ message: `Event must have exactly one ${ActionType.DECLARE} action. Found ${declareActionCount} for event ${event2.id}`,
6974
+ path: ["actions"]
6975
+ });
6976
+ return false;
6977
+ }
6978
+ return true;
6979
+ }
6980
+ function validateDeclarationGivenExactlyOnce(config, ctx) {
6981
+ const declareActionIndex = config.actions.findIndex(
6982
+ (action) => action.type === ActionType.DECLARE
6983
+ );
6984
+ const declareAction = config.actions[declareActionIndex];
6985
+ const onDeclareAction = declareAction.type === ActionType.DECLARE && !!declareAction.declaration;
6986
+ const onTopLevel = !!config.declaration;
6987
+ const declareActionPath = `actions[${declareActionIndex}].declaration`;
6988
+ if (onTopLevel && onDeclareAction) {
6989
+ ctx.addIssue({
6990
+ code: "custom",
6991
+ message: `Event '${config.id}' defines \`declaration\` both at the top level and on the ${ActionType.DECLARE} action (\`${declareActionPath}\`). Define it in only one of these places.`,
6992
+ path: ["declaration"]
6993
+ });
6994
+ }
6995
+ if (!onTopLevel && !onDeclareAction) {
6996
+ ctx.addIssue({
6997
+ code: "custom",
6998
+ message: `Event '${config.id}' does not define \`declaration\`. Define it either at the top level or on the ${ActionType.DECLARE} action (\`${declareActionPath}\`).`,
6999
+ path: ["declaration"]
7000
+ });
7001
+ }
7002
+ }
7003
+ function validateNotificationForm(event2, ctx) {
7004
+ const declarationFields = getDeclarationPages(event2).flatMap(
7005
+ (page) => page.fields.map((field3) => ({ field: field3, pageId: page.id }))
7006
+ );
7007
+ event2.actions.forEach((action, actionIndex) => {
7008
+ if (action.type !== ActionType.NOTIFY) {
7009
+ return;
7010
+ }
7011
+ action.notificationForm.pages.forEach((page, pageIndex) => {
7012
+ page.fields.forEach((field3, fieldIndex) => {
7013
+ const path = [
7014
+ "actions",
7015
+ actionIndex,
7016
+ "notificationForm",
7017
+ "pages",
7018
+ pageIndex,
7019
+ "fields",
7020
+ fieldIndex
7021
+ ];
7022
+ const matchingFields = declarationFields.filter(
7023
+ (declarationField) => declarationField.field.id === field3.id
7024
+ );
7025
+ if (matchingFields.length === 0) {
7026
+ ctx.addIssue({
7027
+ code: "custom",
7028
+ message: `Notification form field '${field3.id}' does not exist in the declaration form of event '${event2.id}'. Notification form fields must also be defined in the ${ActionType.DECLARE} action's declaration.`,
7029
+ path
7030
+ });
7031
+ return;
7032
+ }
7033
+ if (!matchingFields.some(
7034
+ (declarationField) => declarationField.field.type === field3.type
7035
+ )) {
7036
+ const [declarationField] = matchingFields;
7037
+ ctx.addIssue({
7038
+ code: "custom",
7039
+ message: `Notification form field '${field3.id}' on page '${page.id}' is of type ${field3.type}, but the declaration form field with the same id in event '${event2.id}' (${ActionType.DECLARE} declaration, page '${declarationField.pageId}') is of type ${declarationField.field.type}.`,
7040
+ path
7041
+ });
7042
+ }
7043
+ });
7044
+ });
7045
+ });
7046
+ }
6840
7047
 
6841
7048
  // ../commons/src/events/EventConfig.ts
6842
7049
  var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
@@ -6861,16 +7068,15 @@ var _EventConfigBase = z35.object({
6861
7068
  summary: SummaryConfig.describe(
6862
7069
  "Summary information displayed in the event overview."
6863
7070
  ),
6864
- label: TranslationConfig.describe("Human-readable label for the event type."),
7071
+ label: TranslationConfig.describe(
7072
+ "Human-readable label for the event type."
7073
+ ),
6865
7074
  actions: z35.array(ActionConfig).describe(
6866
7075
  "Configuration of core and custom actions associated with the event."
6867
7076
  ),
6868
7077
  actionOrder: z35.array(z35.string()).optional().describe(
6869
7078
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
6870
7079
  ),
6871
- declaration: DeclarationFormConfig.describe(
6872
- "Configuration of the form used to gather event data."
6873
- ),
6874
7080
  advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
6875
7081
  "Configuration of fields available in the advanced search feature."
6876
7082
  ),
@@ -6885,6 +7091,10 @@ var _EventConfigBase = z35.object({
6885
7091
  )
6886
7092
  });
6887
7093
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
7094
+ if (!validateExactlyOneDeclareAction(event2, ctx)) {
7095
+ return;
7096
+ }
7097
+ validateNotificationForm(event2, ctx);
6888
7098
  validateAdvancedSearchConfig(event2, ctx);
6889
7099
  validateDateOfEvent(event2, ctx);
6890
7100
  validatePlaceOfEvent(event2, ctx);
@@ -6966,7 +7176,7 @@ function createSearchConfig(baseField) {
6966
7176
 
6967
7177
  // ../commons/src/event-config/event-configuration.ts
6968
7178
  function isNonSearchableEventMetadataTimeFieldId(fieldId) {
6969
- return !EventFieldIdInput.safeParse(fieldId).success;
7179
+ return !EventFieldIdInput.validate(fieldId);
6970
7180
  }
6971
7181
  function createEventFieldConfig(fieldId) {
6972
7182
  const baseField = {
@@ -7148,7 +7358,7 @@ var SerializableWithin = z37.object({
7148
7358
  });
7149
7359
  var SerializedQueryExpression = z37.object({
7150
7360
  eventType: z37.string(),
7151
- status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
7361
+ status: z37.optional(z37.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
7152
7362
  createdAt: z37.optional(DateCondition),
7153
7363
  updatedAt: z37.optional(DateCondition),
7154
7364
  "legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
@@ -7157,6 +7367,7 @@ var SerializedQueryExpression = z37.object({
7157
7367
  "legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
7158
7368
  "legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
7159
7369
  "legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
7370
+ "legalStatuses.REVOKED.createdAtLocation": z37.optional(SerializableWithin),
7160
7371
  createdAtLocation: z37.optional(
7161
7372
  z37.union([SerializableWithin, SerializableExact])
7162
7373
  ),
@@ -7317,6 +7528,12 @@ var RegisterActionInput = BaseActionInput.extend(
7317
7528
  var NotifyActionInput = BaseActionInput.extend(
7318
7529
  z39.object({
7319
7530
  type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
7531
+ declaration: BaseActionInput.shape.declaration.describe(
7532
+ "Values for fields of the notification form, keyed by field id. Fields outside the notification form are rejected. Only these values become part of the record declaration, so any id that needs to be searchable must be a declaration field."
7533
+ ),
7534
+ annotation: BaseActionInput.shape.annotation.describe(
7535
+ "Values for notify-only fields (NOTIFY review and form fields), keyed by field id. These are stored on the NOTIFY action, not in the record declaration."
7536
+ ),
7320
7537
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
7321
7538
  createdAtLocation: UUID.nullish().describe(
7322
7539
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
@@ -7389,6 +7606,16 @@ var UnarchiveActionInput = BaseActionInput.extend(
7389
7606
  type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
7390
7607
  }).shape
7391
7608
  );
7609
+ var RevokeRegistrationActionInput = BaseActionInput.extend(
7610
+ z39.object({
7611
+ type: z39.literal(ActionType.REVOKE_REGISTRATION).default(ActionType.REVOKE_REGISTRATION)
7612
+ }).shape
7613
+ );
7614
+ var ReinstateRegistrationActionInput = BaseActionInput.extend(
7615
+ z39.object({
7616
+ type: z39.literal(ActionType.REINSTATE_REGISTRATION).default(ActionType.REINSTATE_REGISTRATION)
7617
+ }).shape
7618
+ );
7392
7619
  var AssignActionInput = BaseActionInput.extend(
7393
7620
  z39.object({
7394
7621
  type: z39.literal(ActionType.ASSIGN),
@@ -7451,6 +7678,12 @@ var ActionInput = z39.discriminatedUnion("type", [
7451
7678
  }),
7452
7679
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
7453
7680
  UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
7681
+ RevokeRegistrationActionInput.meta({
7682
+ id: "RevokeRegistrationActionInput"
7683
+ }),
7684
+ ReinstateRegistrationActionInput.meta({
7685
+ id: "ReinstateRegistrationActionInput"
7686
+ }),
7454
7687
  AssignActionInput.meta({ id: "AssignActionInput" }),
7455
7688
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
7456
7689
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -7526,10 +7759,61 @@ var EventDocumentOnlyLastAction = EventDocument.extend({
7526
7759
  }).brand("EventDocumentOnlyLastAction");
7527
7760
 
7528
7761
  // ../commons/src/events/defineConfig.ts
7529
- var defineConfig = (config) => {
7530
- const input = EventConfig.parse(config);
7531
- return input;
7532
- };
7762
+ var z43 = __toESM(require("zod/v4"));
7763
+ function moveDeclarationToDeclareAction({
7764
+ declaration,
7765
+ ...config
7766
+ }) {
7767
+ if (declaration) {
7768
+ console.warn(
7769
+ `Event '${config.id}' defines \`declaration\` at the top level, which is deprecated and will be removed in a future release. Define it on the ${ActionType.DECLARE} action instead.`
7770
+ );
7771
+ }
7772
+ return {
7773
+ ...config,
7774
+ actions: config.actions.map(
7775
+ (action) => action.type === ActionType.DECLARE && declaration ? { ...action, declaration } : action
7776
+ )
7777
+ };
7778
+ }
7779
+ var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
7780
+ if (validateExactlyOneDeclareAction(config, ctx)) {
7781
+ validateDeclarationGivenExactlyOnce(config, ctx);
7782
+ }
7783
+ }).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
7784
+ var defineConfig = (config) => EventConfigDefinition.parse(config);
7785
+
7786
+ // ../commons/src/events/toNotificationForm.ts
7787
+ function toOptionalField(field3) {
7788
+ const { validation: _validation, ...rest } = field3;
7789
+ if (rest.type === FieldType.FIELD_GROUP && "fields" in rest) {
7790
+ return {
7791
+ ...rest,
7792
+ required: false,
7793
+ fields: rest.fields.map(toOptionalField)
7794
+ };
7795
+ }
7796
+ return { ...rest, required: false };
7797
+ }
7798
+ function toNotificationForm(declaration) {
7799
+ return {
7800
+ ...declaration,
7801
+ pages: declaration.pages.map((page) => ({
7802
+ ...page,
7803
+ fields: page.fields.map(
7804
+ toOptionalField
7805
+ )
7806
+ }))
7807
+ };
7808
+ }
7809
+ function toNotificationReview(review) {
7810
+ return {
7811
+ ...review,
7812
+ fields: review.fields.map(
7813
+ toOptionalField
7814
+ )
7815
+ };
7816
+ }
7533
7817
 
7534
7818
  // ../commons/src/events/transactions.ts
7535
7819
  function generateTransactionId() {
@@ -8846,6 +9130,8 @@ var tennisClubMembershipEvent = defineConfig({
8846
9130
  description: "This is shown as the action name anywhere the user can trigger the action from",
8847
9131
  id: "event.tennis-club-membership.action.notify.label"
8848
9132
  },
9133
+ notificationForm: toNotificationForm(TENNIS_CLUB_DECLARATION_FORM),
9134
+ review: toNotificationReview(TENNIS_CLUB_DECLARATION_REVIEW),
8849
9135
  flags: [
8850
9136
  {
8851
9137
  id: "health-worker-notified",
@@ -9523,7 +9809,24 @@ var libraryMembershipEvent = defineConfig({
9523
9809
  id: "event.library-membership.title"
9524
9810
  },
9525
9811
  summary: { fields: [] },
9526
- actions: [],
9812
+ actions: [
9813
+ {
9814
+ type: ActionType.DECLARE,
9815
+ label: {
9816
+ defaultMessage: "Declare",
9817
+ description: "This is shown as the action name anywhere the user can trigger the action from",
9818
+ id: "event.library-membership.action.declare.label"
9819
+ },
9820
+ review: {
9821
+ title: {
9822
+ defaultMessage: "Library membership application",
9823
+ description: "Title of the review page",
9824
+ id: "event.library-membership.action.declare.form.review.title"
9825
+ },
9826
+ fields: []
9827
+ }
9828
+ }
9829
+ ],
9527
9830
  declaration: libraryMembershipForm
9528
9831
  });
9529
9832
 
@@ -9969,6 +10272,22 @@ var digitalIdentityEvent = defineConfig({
9969
10272
  },
9970
10273
  summary: { fields: [] },
9971
10274
  actions: [
10275
+ {
10276
+ type: ActionType.DECLARE,
10277
+ label: {
10278
+ defaultMessage: "Declare",
10279
+ description: "This is shown as the action name anywhere the user can trigger the action from",
10280
+ id: "event.digital-identity.action.declare.label"
10281
+ },
10282
+ review: {
10283
+ title: {
10284
+ defaultMessage: "Digital identity issuance",
10285
+ description: "Title of the review page",
10286
+ id: "event.digital-identity.action.declare.form.review.title"
10287
+ },
10288
+ fields: []
10289
+ }
10290
+ },
9972
10291
  {
9973
10292
  type: ActionType.PRINT_CERTIFICATE,
9974
10293
  label: {
@@ -9983,45 +10302,45 @@ var digitalIdentityEvent = defineConfig({
9983
10302
  });
9984
10303
 
9985
10304
  // ../commons/src/events/test.utils.ts
9986
- var z44 = __toESM(require("zod/v4"));
10305
+ var z45 = __toESM(require("zod/v4"));
9987
10306
 
9988
10307
  // ../commons/src/events/locations.ts
9989
- var z43 = __toESM(require("zod/v4"));
9990
- var LocationTypeV1 = z43.enum([
10308
+ var z44 = __toESM(require("zod/v4"));
10309
+ var LocationTypeV1 = z44.enum([
9991
10310
  "ADMIN_STRUCTURE",
9992
10311
  "CRVS_OFFICE",
9993
10312
  "HEALTH_FACILITY"
9994
10313
  ]);
9995
- var LocationStatus = z43.enum(["active", "inactive"]);
10314
+ var LocationStatus = z44.enum(["active", "inactive"]);
9996
10315
  var InactiveOfficeError = class extends Error {
9997
10316
  constructor(message = "Assigned office is inactive") {
9998
10317
  super(message);
9999
10318
  this.name = "InactiveOfficeError";
10000
10319
  }
10001
10320
  };
10002
- var LocationVersion = z43.object({
10321
+ var LocationVersion = z44.object({
10003
10322
  versionId: UUID,
10004
- effectiveFrom: z43.iso.date(),
10005
- name: z43.string(),
10006
- externalId: z43.string().nullish(),
10323
+ effectiveFrom: z44.iso.date(),
10324
+ name: z44.string(),
10325
+ externalId: z44.string().nullish(),
10007
10326
  status: LocationStatus
10008
10327
  });
10009
- var AdministrativeArea = z43.object({
10328
+ var AdministrativeArea = z44.object({
10010
10329
  id: UUID,
10011
- name: z43.string(),
10012
- externalId: z43.string().nullish(),
10330
+ name: z44.string(),
10331
+ externalId: z44.string().nullish(),
10013
10332
  parentId: UUID.nullable(),
10014
10333
  status: LocationStatus,
10015
- versions: z43.array(LocationVersion)
10334
+ versions: z44.array(LocationVersion)
10016
10335
  });
10017
- var Location = z43.object({
10336
+ var Location = z44.object({
10018
10337
  id: UUID,
10019
- name: z43.string(),
10020
- externalId: z43.string().nullish(),
10338
+ name: z44.string(),
10339
+ externalId: z44.string().nullish(),
10021
10340
  administrativeAreaId: UUID.nullable(),
10022
- locationType: z43.string().nullable(),
10341
+ locationType: z44.string().nullable(),
10023
10342
  status: LocationStatus,
10024
- versions: z43.array(LocationVersion)
10343
+ versions: z44.array(LocationVersion)
10025
10344
  });
10026
10345
  var ClientAdministrativeArea = AdministrativeArea.omit({
10027
10346
  name: true,
@@ -10062,22 +10381,22 @@ function validateUniqueIds(versions, ctx) {
10062
10381
  ctx.addIssue("versions must not repeat a versionId");
10063
10382
  }
10064
10383
  }
10065
- var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
10384
+ var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
10066
10385
  validateAscendingDates(versions, ctx);
10067
10386
  validateUniqueIds(versions, ctx);
10068
10387
  });
10069
- var SetLocationPayload = z43.object({
10388
+ var SetLocationPayload = z44.object({
10070
10389
  id: UUID,
10071
- name: z43.string(),
10072
- externalId: z43.string().nullish(),
10390
+ name: z44.string(),
10391
+ externalId: z44.string().nullish(),
10073
10392
  administrativeAreaId: UUID.nullable(),
10074
- locationType: z43.string().nullable(),
10393
+ locationType: z44.string().nullable(),
10075
10394
  versions: SeededLocationVersions.optional()
10076
10395
  });
10077
- var SetAdministrativeAreaPayload = z43.object({
10396
+ var SetAdministrativeAreaPayload = z44.object({
10078
10397
  id: UUID,
10079
- name: z43.string(),
10080
- externalId: z43.string().nullish(),
10398
+ name: z44.string(),
10399
+ externalId: z44.string().nullish(),
10081
10400
  parentId: UUID.nullable(),
10082
10401
  versions: SeededLocationVersions.optional()
10083
10402
  });
@@ -10280,8 +10599,8 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
10280
10599
  }
10281
10600
  function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
10282
10601
  const collectedLocations = [];
10283
- const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
10284
- let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
10602
+ const maybeAdministrativeAreaId = maybeUuid(administrativeAreaId);
10603
+ let current = maybeAdministrativeAreaId ? administrativeAreas.get(maybeAdministrativeAreaId) : null;
10285
10604
  while (current) {
10286
10605
  collectedLocations.push(current);
10287
10606
  if (!current.parentId) {
@@ -10666,7 +10985,7 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
10666
10985
 
10667
10986
  // ../commons/src/events/test.utils.ts
10668
10987
  var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
10669
- var TestUserRole = z44.enum([
10988
+ var TestUserRole = z45.enum([
10670
10989
  "FIELD_AGENT",
10671
10990
  "LOCAL_REGISTRAR",
10672
10991
  "LOCAL_SYSTEM_ADMIN",
@@ -10881,11 +11200,10 @@ function fieldConfigsToActionPayload(fields, rng, administrativeHierarchy) {
10881
11200
  );
10882
11201
  }
10883
11202
  function generateActionDeclarationInput(configuration, action, rng, overrides, administrativeHierarchy) {
10884
- const parsed = DeclarationUpdateActions.safeParse(action);
10885
11203
  if ((0, import_lodash5.isEmpty)(overrides) && typeof overrides === "object") {
10886
11204
  return {};
10887
11205
  }
10888
- if (parsed.success) {
11206
+ if (DeclarationUpdateActions.validate(action)) {
10889
11207
  const fields = getDeclarationFields(configuration);
10890
11208
  const declarationConfig = getDeclaration(configuration);
10891
11209
  const declaration = fieldConfigsToActionPayload(
@@ -11076,6 +11394,22 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
11076
11394
  eventId,
11077
11395
  ...input
11078
11396
  }),
11397
+ revokeRegistration: (eventId, input = {}) => ({
11398
+ type: ActionType.REVOKE_REGISTRATION,
11399
+ transactionId: input.transactionId ?? getUUID(),
11400
+ declaration: {},
11401
+ annotation: {},
11402
+ eventId,
11403
+ ...input
11404
+ }),
11405
+ reinstateRegistration: (eventId, input = {}) => ({
11406
+ type: ActionType.REINSTATE_REGISTRATION,
11407
+ transactionId: input.transactionId ?? getUUID(),
11408
+ declaration: {},
11409
+ annotation: {},
11410
+ eventId,
11411
+ ...input
11412
+ }),
11079
11413
  reject: (eventId, input = {}) => ({
11080
11414
  type: ActionType.REJECT,
11081
11415
  transactionId: input.transactionId ?? getUUID(),
@@ -11244,6 +11578,8 @@ function generateActionDocument({
11244
11578
  case ActionType.REGISTER:
11245
11579
  case ActionType.REQUEST_CORRECTION:
11246
11580
  case ActionType.UNARCHIVE:
11581
+ case ActionType.REVOKE_REGISTRATION:
11582
+ case ActionType.REINSTATE_REGISTRATION:
11247
11583
  return { ...actionBase, type: action };
11248
11584
  case ActionType.EDIT:
11249
11585
  return {
@@ -11498,6 +11834,20 @@ var generateEventConfig = ({
11498
11834
  ]
11499
11835
  });
11500
11836
  };
11837
+ function withDeclaration(configuration, declaration) {
11838
+ return {
11839
+ ...configuration,
11840
+ actions: configuration.actions.map((action) => {
11841
+ if (action.type === ActionType.DECLARE) {
11842
+ return { ...action, declaration };
11843
+ }
11844
+ if (action.type === ActionType.NOTIFY) {
11845
+ return { ...action, notificationForm: toNotificationForm(declaration) };
11846
+ }
11847
+ return action;
11848
+ })
11849
+ };
11850
+ }
11501
11851
  function getLeafAdministrativeAreaIds(administrativeAreas) {
11502
11852
  const nonLeafAdministrativeAreaIds = /* @__PURE__ */ new Set();
11503
11853
  for (const [, location] of administrativeAreas) {
@@ -11559,7 +11909,7 @@ function isTemplateVariable(value) {
11559
11909
  return typeof value === "string" && value.startsWith("$");
11560
11910
  }
11561
11911
  function isFieldValue(value) {
11562
- return FieldValue.safeParse(value).success;
11912
+ return FieldValue.validate(value);
11563
11913
  }
11564
11914
  function isFieldValueWithoutTemplates(value) {
11565
11915
  if (isTemplateVariable(value)) {
@@ -11604,6 +11954,8 @@ var ACTION_SCOPE_MAP = {
11604
11954
  [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
11605
11955
  [ActionType.REJECT_CORRECTION]: ["record.correct"],
11606
11956
  [ActionType.APPROVE_CORRECTION]: ["record.correct"],
11957
+ [ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
11958
+ [ActionType.REINSTATE_REGISTRATION]: ["record.reinstate-registration"],
11607
11959
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
11608
11960
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
11609
11961
  [ActionType.ARCHIVE]: ["record.archive"],
@@ -11626,6 +11978,8 @@ var DOCUMENT_DELETE_SCOPES = [
11626
11978
  "record.print-certified-copies",
11627
11979
  "record.request-correction",
11628
11980
  "record.correct",
11981
+ "record.revoke-registration",
11982
+ "record.reinstate-registration",
11629
11983
  "record.review-duplicates",
11630
11984
  "record.archive",
11631
11985
  "record.unarchive",
@@ -11765,6 +12119,10 @@ function deserializeQueryExpression(expression, user2) {
11765
12119
  expression["legalStatuses.REGISTERED.createdAtLocation"].location,
11766
12120
  user2
11767
12121
  ) : void 0;
12122
+ const revokedLocation = expression["legalStatuses.REVOKED.createdAtLocation"] ? userDeserializer(
12123
+ expression["legalStatuses.REVOKED.createdAtLocation"].location,
12124
+ user2
12125
+ ) : void 0;
11768
12126
  return {
11769
12127
  ...expression,
11770
12128
  assignedTo: expression.assignedTo && isDefined(assignedTo) ? { ...expression.assignedTo, term: assignedTo } : void 0,
@@ -11783,6 +12141,10 @@ function deserializeQueryExpression(expression, user2) {
11783
12141
  ["legalStatuses.REGISTERED.createdAtLocation"]: expression["legalStatuses.REGISTERED.createdAtLocation"] && isDefined(registeredLocation) ? {
11784
12142
  ...expression["legalStatuses.REGISTERED.createdAtLocation"],
11785
12143
  location: registeredLocation
12144
+ } : void 0,
12145
+ ["legalStatuses.REVOKED.createdAtLocation"]: expression["legalStatuses.REVOKED.createdAtLocation"] && isDefined(revokedLocation) ? {
12146
+ ...expression["legalStatuses.REVOKED.createdAtLocation"],
12147
+ location: revokedLocation
11786
12148
  } : void 0
11787
12149
  };
11788
12150
  }
@@ -11829,7 +12191,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
11829
12191
  ActionType.APPROVE_CORRECTION,
11830
12192
  ActionType.REJECT_CORRECTION,
11831
12193
  ActionType.CUSTOM,
11832
- ClientSpecificAction.REVIEW_CORRECTION_REQUEST
12194
+ ClientSpecificAction.REVIEW_CORRECTION_REQUEST,
12195
+ ActionType.REVOKE_REGISTRATION
12196
+ ],
12197
+ [EventStatus.enum.REVOKED]: [
12198
+ ActionType.READ,
12199
+ ActionType.REINSTATE_REGISTRATION
11833
12200
  ],
11834
12201
  [EventStatus.enum.ARCHIVED]: [
11835
12202
  ActionType.READ,
@@ -11843,6 +12210,8 @@ var ACTION_FILTERS = {
11843
12210
  [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
11844
12211
  [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
11845
12212
  [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
12213
+ [ActionType.REVOKE_REGISTRATION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
12214
+ [ActionType.REINSTATE_REGISTRATION]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
11846
12215
  [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
11847
12216
  [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
11848
12217
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
@@ -11892,13 +12261,11 @@ function getFilePathsFromEvent(event2) {
11892
12261
  ...declarationValues,
11893
12262
  ...annotationValues
11894
12263
  ].flatMap((value) => {
11895
- const fileParsed = FileFieldValue.safeParse(value);
11896
- if (fileParsed.success) {
11897
- return [fileParsed.data.path];
12264
+ if (isFileFieldValue(value)) {
12265
+ return [value.path];
11898
12266
  }
11899
- const fileOptionParsed = FileFieldWithOptionValue.safeParse(value);
11900
- if (fileOptionParsed.success) {
11901
- return fileOptionParsed.data.map((val) => val.path);
12267
+ if (isFileFieldWithOptionValue(value)) {
12268
+ return value.map((val) => val.path);
11902
12269
  }
11903
12270
  return [];
11904
12271
  });
@@ -11908,49 +12275,49 @@ function getFilePathsFromEvent(event2) {
11908
12275
  }
11909
12276
 
11910
12277
  // ../commons/src/events/locationPayloads.ts
11911
- var z45 = __toESM(require("zod/v4"));
11912
- var CreateLocationPayload = z45.object({
12278
+ var z46 = __toESM(require("zod/v4"));
12279
+ var CreateLocationPayload = z46.object({
11913
12280
  id: UUID.optional(),
11914
12281
  versionId: UUID.optional(),
11915
- name: z45.string(),
11916
- externalId: z45.string().nullish(),
12282
+ name: z46.string(),
12283
+ externalId: z46.string().nullish(),
11917
12284
  administrativeAreaId: UUID.nullable(),
11918
- locationType: z45.string().nullable(),
11919
- effectiveFrom: z45.iso.date().optional(),
12285
+ locationType: z46.string().nullable(),
12286
+ effectiveFrom: z46.iso.date().optional(),
11920
12287
  status: LocationStatus.default("active")
11921
12288
  });
11922
- var UpdateLocationPayload = z45.strictObject({
12289
+ var UpdateLocationPayload = z46.strictObject({
11923
12290
  id: UUID,
11924
12291
  versionId: UUID.optional(),
11925
- name: z45.string(),
11926
- externalId: z45.string().nullish(),
12292
+ name: z46.string(),
12293
+ externalId: z46.string().nullish(),
11927
12294
  status: LocationStatus,
11928
- effectiveFrom: z45.iso.date().optional(),
12295
+ effectiveFrom: z46.iso.date().optional(),
11929
12296
  lastVersionId: UUID
11930
12297
  });
11931
- var WithdrawLocationVersionPayload = z45.object({
12298
+ var WithdrawLocationVersionPayload = z46.object({
11932
12299
  id: UUID,
11933
12300
  versionId: UUID
11934
12301
  });
11935
- var CreateAdministrativeAreaPayload = z45.object({
12302
+ var CreateAdministrativeAreaPayload = z46.object({
11936
12303
  id: UUID.optional(),
11937
12304
  versionId: UUID.optional(),
11938
- name: z45.string(),
11939
- externalId: z45.string().nullish(),
12305
+ name: z46.string(),
12306
+ externalId: z46.string().nullish(),
11940
12307
  parentId: UUID.nullable(),
11941
- effectiveFrom: z45.iso.date().optional(),
12308
+ effectiveFrom: z46.iso.date().optional(),
11942
12309
  status: LocationStatus.default("active")
11943
12310
  });
11944
- var UpdateAdministrativeAreaPayload = z45.strictObject({
12311
+ var UpdateAdministrativeAreaPayload = z46.strictObject({
11945
12312
  id: UUID,
11946
12313
  versionId: UUID.optional(),
11947
- name: z45.string(),
11948
- externalId: z45.string().nullish(),
12314
+ name: z46.string(),
12315
+ externalId: z46.string().nullish(),
11949
12316
  status: LocationStatus,
11950
- effectiveFrom: z45.iso.date().optional(),
12317
+ effectiveFrom: z46.iso.date().optional(),
11951
12318
  lastVersionId: UUID
11952
12319
  });
11953
- var WithdrawAdministrativeAreaVersionPayload = z45.object({
12320
+ var WithdrawAdministrativeAreaVersionPayload = z46.object({
11954
12321
  id: UUID,
11955
12322
  versionId: UUID
11956
12323
  });