@opencrvs/toolkit 2.1.1 → 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.1.tgz +0 -0
@@ -38,7 +38,10 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z47 = __toESM(require("zod/v4"));
41
+ var z48 = __toESM(require("zod/v4"));
42
+
43
+ // ../commons/src/events/index.ts
44
+ var import_compile = require("zod/compile");
42
45
 
43
46
  // ../commons/src/events/AuditLog.ts
44
47
  var z9 = __toESM(require("zod/v4"));
@@ -83,6 +86,8 @@ var ActionType = {
83
86
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
84
87
  REJECT_CORRECTION: "REJECT_CORRECTION",
85
88
  APPROVE_CORRECTION: "APPROVE_CORRECTION",
89
+ REVOKE_REGISTRATION: "REVOKE_REGISTRATION",
90
+ REINSTATE_REGISTRATION: "REINSTATE_REGISTRATION",
86
91
  // General actions
87
92
  READ: "READ",
88
93
  ASSIGN: "ASSIGN",
@@ -102,6 +107,8 @@ var ConfirmableActions = [
102
107
  ActionType.REQUEST_CORRECTION,
103
108
  ActionType.APPROVE_CORRECTION,
104
109
  ActionType.REJECT_CORRECTION,
110
+ ActionType.REVOKE_REGISTRATION,
111
+ ActionType.REINSTATE_REGISTRATION,
105
112
  ActionType.CUSTOM
106
113
  ];
107
114
  var ActionTypes = z2.enum([
@@ -121,6 +128,8 @@ var ActionTypes = z2.enum([
121
128
  "REQUEST_CORRECTION",
122
129
  "REJECT_CORRECTION",
123
130
  "APPROVE_CORRECTION",
131
+ "REVOKE_REGISTRATION",
132
+ "REINSTATE_REGISTRATION",
124
133
  "READ",
125
134
  "ASSIGN",
126
135
  "UNASSIGN",
@@ -162,7 +171,9 @@ var WorkqueueActionType = ActionTypes.extract([
162
171
  ActionType.ARCHIVE,
163
172
  ActionType.UNARCHIVE,
164
173
  ActionType.PRINT_CERTIFICATE,
165
- ActionType.REQUEST_CORRECTION
174
+ ActionType.REQUEST_CORRECTION,
175
+ ActionType.REVOKE_REGISTRATION,
176
+ ActionType.REINSTATE_REGISTRATION
166
177
  ]);
167
178
  var META_ACTIONS = [
168
179
  ActionType.ASSIGN,
@@ -178,7 +189,7 @@ var ActionStatus = {
178
189
  };
179
190
 
180
191
  // ../commons/src/events/Flag.ts
181
- var z5 = __toESM(require("zod/v4"));
192
+ var z5 = __toESM(require("zod"));
182
193
 
183
194
  // ../commons/src/events/TranslationConfig.ts
184
195
  var z3 = __toESM(require("zod/v4"));
@@ -247,7 +258,6 @@ var FieldConditional = z4.discriminatedUnion("type", [
247
258
 
248
259
  // ../commons/src/events/Flag.ts
249
260
  var InherentFlags = {
250
- INCOMPLETE: "incomplete",
251
261
  REJECTED: "rejected",
252
262
  CORRECTION_REQUESTED: "correction-requested",
253
263
  POTENTIAL_DUPLICATE: "potential-duplicate",
@@ -275,7 +285,7 @@ var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).inclu
275
285
  message: `Custom flag cannot be one of the inherent flags: ${Object.values(
276
286
  InherentFlags
277
287
  ).join(", ")}`
278
- }).refine((val) => !ActionFlag.safeParse(val).success, {
288
+ }).refine((val) => !ActionFlag.validate(val), {
279
289
  message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
280
290
  }).describe("Custom flag identifier defined by the country config.");
281
291
  var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
@@ -314,6 +324,7 @@ var EventStatus = z6.enum([
314
324
  "NOTIFIED",
315
325
  "DECLARED",
316
326
  "REGISTERED",
327
+ "REVOKED",
317
328
  "ARCHIVED"
318
329
  ]);
319
330
 
@@ -337,6 +348,8 @@ var RecordScopeTypeV2 = z7.enum([
337
348
  "record.print-certified-copies",
338
349
  "record.request-correction",
339
350
  "record.correct",
351
+ "record.revoke-registration",
352
+ "record.reinstate-registration",
340
353
  "record.unassign-others",
341
354
  "record.custom-action",
342
355
  "record.action.accept",
@@ -463,6 +476,8 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
463
476
  "record.read",
464
477
  "record.request-correction",
465
478
  "record.correct",
479
+ "record.revoke-registration",
480
+ "record.reinstate-registration",
466
481
  "record.unassign-others",
467
482
  "record.review-duplicates"
468
483
  ]);
@@ -648,6 +663,8 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
648
663
  "event.actions.correction.request.request",
649
664
  "event.actions.correction.approve.request",
650
665
  "event.actions.correction.reject.request",
666
+ "event.actions.revoke_registration.request",
667
+ "event.actions.reinstate_registration.request",
651
668
  "event.actions.mark_as_duplicate.request",
652
669
  "event.actions.mark_as_not_duplicate.request"
653
670
  ]),
@@ -982,7 +999,7 @@ var z14 = __toESM(require("zod/v4"));
982
999
  // ../commons/src/documents.ts
983
1000
  var z11 = __toESM(require("zod/v4"));
984
1001
  var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
985
- "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"
1002
+ "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"
986
1003
  );
987
1004
  var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
988
1005
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
@@ -992,7 +1009,7 @@ var DocumentPath = z11.string().brand("DocumentPath").describe(
992
1009
  );
993
1010
 
994
1011
  // ../commons/src/events/CompositeFieldValue.ts
995
- var z12 = __toESM(require("zod/v4"));
1012
+ var z12 = __toESM(require("zod"));
996
1013
  var AddressType = {
997
1014
  DOMESTIC: "DOMESTIC",
998
1015
  INTERNATIONAL: "INTERNATIONAL"
@@ -1197,7 +1214,7 @@ function safeUnion(schemas) {
1197
1214
  );
1198
1215
  return z14.any().superRefine((val, ctx) => {
1199
1216
  for (const schema of sortedSchemas) {
1200
- if (schema.safeParse(val).success) {
1217
+ if (schema.validate(val)) {
1201
1218
  return;
1202
1219
  }
1203
1220
  }
@@ -1391,6 +1408,16 @@ var UnarchiveAction = ActionBase.extend(
1391
1408
  type: z16.literal(ActionType.UNARCHIVE)
1392
1409
  }).shape
1393
1410
  );
1411
+ var RevokeRegistrationAction = ActionBase.extend(
1412
+ z16.object({
1413
+ type: z16.literal(ActionType.REVOKE_REGISTRATION)
1414
+ }).shape
1415
+ );
1416
+ var ReinstateRegistrationAction = ActionBase.extend(
1417
+ z16.object({
1418
+ type: z16.literal(ActionType.REINSTATE_REGISTRATION)
1419
+ }).shape
1420
+ );
1394
1421
  var CreatedAction = ActionBase.extend(
1395
1422
  z16.object({
1396
1423
  type: z16.literal(ActionType.CREATE)
@@ -1459,6 +1486,8 @@ var ActionDocument = z16.discriminatedUnion("type", [
1459
1486
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1460
1487
  ArchiveAction.meta({ id: "ArchiveAction" }),
1461
1488
  UnarchiveAction.meta({ id: "UnarchiveAction" }),
1489
+ RevokeRegistrationAction.meta({ id: "RevokeRegistrationAction" }),
1490
+ ReinstateRegistrationAction.meta({ id: "ReinstateRegistrationAction" }),
1462
1491
  NotifiedAction.meta({ id: "NotifiedAction" }),
1463
1492
  RegisterAction.meta({ id: "RegisterAction" }),
1464
1493
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1507,7 +1536,8 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1507
1536
  var LegalStatuses = z17.object({
1508
1537
  [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1509
1538
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1510
- [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1539
+ [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish(),
1540
+ [EventStatus.enum.REVOKED]: ActionCreationMetadata.nullish()
1511
1541
  });
1512
1542
  var EventMetadata = z17.object({
1513
1543
  id: UUID,
@@ -1627,6 +1657,12 @@ var AnyOfStatus = import_v4.z.object({
1627
1657
  }).meta({
1628
1658
  id: "AnyOfStatus"
1629
1659
  });
1660
+ var NoneOfStatus = import_v4.z.object({
1661
+ type: import_v4.z.literal("noneOf"),
1662
+ terms: import_v4.z.array(EventStatus)
1663
+ }).meta({
1664
+ id: "NoneOfStatus"
1665
+ });
1630
1666
  var Range = import_v4.z.object({
1631
1667
  type: import_v4.z.literal("range"),
1632
1668
  gte: import_v4.z.string(),
@@ -1667,7 +1703,7 @@ var QueryInput = import_v4.z.lazy(
1667
1703
  var QueryExpression = import_v4.z.object({
1668
1704
  id: import_v4.z.optional(import_v4.z.string()),
1669
1705
  eventType: import_v4.z.string(),
1670
- status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
1706
+ status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
1671
1707
  createdAt: import_v4.z.optional(DateCondition),
1672
1708
  updatedAt: import_v4.z.optional(DateCondition),
1673
1709
  "legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(Within).nullable(),
@@ -1676,6 +1712,7 @@ var QueryExpression = import_v4.z.object({
1676
1712
  "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1677
1713
  "legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
1678
1714
  "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
1715
+ "legalStatuses.REVOKED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1679
1716
  createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1680
1717
  updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1681
1718
  assignedTo: import_v4.z.optional(Exact),
@@ -2873,6 +2910,12 @@ var ReadActionConfig = ActionConfigBase.extend(
2873
2910
  var NotifyConfig = ActionConfigBase.extend(
2874
2911
  z25.object({
2875
2912
  type: z25.literal(ActionType.NOTIFY),
2913
+ notificationForm: DeclarationFormConfig.describe(
2914
+ "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."
2915
+ ),
2916
+ review: DeclarationReviewConfig.describe(
2917
+ "Review page configuration for the notify action. Values of its fields are stored as the NOTIFY action annotation."
2918
+ ),
2876
2919
  form: actionConfirmationForm
2877
2920
  }).shape
2878
2921
  );
@@ -2925,6 +2968,9 @@ var DeleteConfig = ActionConfigBase.extend(
2925
2968
  var DeclareConfig = DeclarationActionBase.extend(
2926
2969
  z25.object({
2927
2970
  type: z25.literal(ActionType.DECLARE),
2971
+ declaration: DeclarationFormConfig.describe(
2972
+ "Configuration of the form used to gather event data."
2973
+ ),
2928
2974
  review: DeclarationReviewConfig.describe(
2929
2975
  "Configuration of the review page fields."
2930
2976
  ),
@@ -2953,6 +2999,18 @@ var UnarchiveConfig = ActionConfigBase.extend(
2953
2999
  type: z25.literal(ActionType.UNARCHIVE)
2954
3000
  }).shape
2955
3001
  );
3002
+ var RevokeRegistrationConfig = ActionConfigBase.extend(
3003
+ z25.object({
3004
+ type: z25.literal(ActionType.REVOKE_REGISTRATION),
3005
+ form: actionConfirmationForm
3006
+ }).shape
3007
+ );
3008
+ var ReinstateRegistrationConfig = ActionConfigBase.extend(
3009
+ z25.object({
3010
+ type: z25.literal(ActionType.REINSTATE_REGISTRATION),
3011
+ form: actionConfirmationForm
3012
+ }).shape
3013
+ );
2956
3014
  var EditActionConfig = ActionConfigBase.extend(
2957
3015
  z25.object({
2958
3016
  type: z25.literal(ActionType.EDIT),
@@ -3039,11 +3097,11 @@ var ActionConfig = z25.discriminatedUnion("type", [
3039
3097
  }),
3040
3098
  NotifyConfig.meta({
3041
3099
  id: "NotifyActionConfig",
3042
- description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
3100
+ description: "Configuration for the notify action, including the notification form and its review page. When undefined, it is generated using the DeclareActionConfig."
3043
3101
  }),
3044
3102
  DeclareConfig.meta({
3045
3103
  id: "DeclareActionConfig",
3046
- description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3104
+ description: "Configuration for the declare action. Includes the declaration form and review-page fields."
3047
3105
  }),
3048
3106
  DuplicateDetectedConfig.meta({
3049
3107
  id: "DuplicateDetectedActionConfig",
@@ -3093,6 +3151,14 @@ var ActionConfig = z25.discriminatedUnion("type", [
3093
3151
  id: "UnarchiveActionConfig",
3094
3152
  description: "Configuration for unarchiving a record."
3095
3153
  }),
3154
+ RevokeRegistrationConfig.meta({
3155
+ id: "RevokeRegistrationActionConfig",
3156
+ description: "Configuration for revoking a registered record."
3157
+ }),
3158
+ ReinstateRegistrationConfig.meta({
3159
+ id: "ReinstateRegistrationActionConfig",
3160
+ description: "Configuration for reinstating a revoked record back to registered."
3161
+ }),
3096
3162
  CustomActionConfig.meta({
3097
3163
  id: "CustomActionConfig",
3098
3164
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3503,6 +3569,8 @@ var updateActions = new Set(
3503
3569
  ActionType.REQUEST_CORRECTION,
3504
3570
  ActionType.APPROVE_CORRECTION,
3505
3571
  ActionType.REJECT_CORRECTION,
3572
+ ActionType.REVOKE_REGISTRATION,
3573
+ ActionType.REINSTATE_REGISTRATION,
3506
3574
  ActionType.CUSTOM
3507
3575
  ]).options
3508
3576
  );
@@ -3516,15 +3584,6 @@ var INHERENT_FLAG_RULES = [
3516
3584
  setOn: [ActionType.REQUEST_CORRECTION],
3517
3585
  resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
3518
3586
  },
3519
- {
3520
- // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
3521
- // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
3522
- // are deliberately excluded so the flag freezes across an archive/unarchive
3523
- // round trip and comes back exactly as it was.
3524
- flag: InherentFlags.INCOMPLETE,
3525
- setOn: [ActionType.NOTIFY],
3526
- resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
3527
- },
3528
3587
  {
3529
3588
  flag: InherentFlags.REJECTED,
3530
3589
  setOn: [ActionType.REJECT],
@@ -4322,8 +4381,28 @@ function isOnline() {
4322
4381
 
4323
4382
  // ../commons/src/events/utils.ts
4324
4383
  var import_date_fns3 = require("date-fns");
4384
+ function getDeclaration(configuration) {
4385
+ const declareAction = configuration.actions.find(
4386
+ (action) => action.type === ActionType.DECLARE
4387
+ );
4388
+ if (!declareAction) {
4389
+ throw new Error(
4390
+ `Event '${configuration.id}' has no ${ActionType.DECLARE} action to read the declaration from`
4391
+ );
4392
+ }
4393
+ return declareAction.declaration;
4394
+ }
4395
+ function getDeclarationPages(configuration) {
4396
+ return getDeclaration(configuration).pages;
4397
+ }
4325
4398
  function getDeclarationFields(configuration) {
4326
- return configuration.declaration.pages.flatMap(({ fields }) => fields);
4399
+ return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
4400
+ }
4401
+ function getConfiguredNotificationForm(configuration) {
4402
+ const notifyAction = configuration.actions.find(
4403
+ (action) => action.type === ActionType.NOTIFY
4404
+ );
4405
+ return notifyAction?.type === ActionType.NOTIFY ? notifyAction.notificationForm : void 0;
4327
4406
  }
4328
4407
  var getActionAnnotationFields = (actionConfig) => {
4329
4408
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
@@ -4342,6 +4421,9 @@ function getAllAnnotationFields(config) {
4342
4421
  var findAllFields = (config) => {
4343
4422
  return (0, import_lodash4.flattenDeep)([
4344
4423
  ...getDeclarationFields(config),
4424
+ ...getConfiguredNotificationForm(config)?.pages.flatMap(
4425
+ ({ fields }) => fields
4426
+ ) ?? [],
4345
4427
  ...getAllAnnotationFields(config)
4346
4428
  ]);
4347
4429
  };
@@ -4469,6 +4551,87 @@ function validateActionOrder(event2, ctx) {
4469
4551
  }
4470
4552
  }
4471
4553
  }
4554
+ function validateExactlyOneDeclareAction(event2, ctx) {
4555
+ const declareActionCount = event2.actions.filter(
4556
+ (action) => action.type === ActionType.DECLARE
4557
+ ).length;
4558
+ if (declareActionCount !== 1) {
4559
+ ctx.addIssue({
4560
+ code: "custom",
4561
+ message: `Event must have exactly one ${ActionType.DECLARE} action. Found ${declareActionCount} for event ${event2.id}`,
4562
+ path: ["actions"]
4563
+ });
4564
+ return false;
4565
+ }
4566
+ return true;
4567
+ }
4568
+ function validateDeclarationGivenExactlyOnce(config, ctx) {
4569
+ const declareActionIndex = config.actions.findIndex(
4570
+ (action) => action.type === ActionType.DECLARE
4571
+ );
4572
+ const declareAction = config.actions[declareActionIndex];
4573
+ const onDeclareAction = declareAction.type === ActionType.DECLARE && !!declareAction.declaration;
4574
+ const onTopLevel = !!config.declaration;
4575
+ const declareActionPath = `actions[${declareActionIndex}].declaration`;
4576
+ if (onTopLevel && onDeclareAction) {
4577
+ ctx.addIssue({
4578
+ code: "custom",
4579
+ 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.`,
4580
+ path: ["declaration"]
4581
+ });
4582
+ }
4583
+ if (!onTopLevel && !onDeclareAction) {
4584
+ ctx.addIssue({
4585
+ code: "custom",
4586
+ message: `Event '${config.id}' does not define \`declaration\`. Define it either at the top level or on the ${ActionType.DECLARE} action (\`${declareActionPath}\`).`,
4587
+ path: ["declaration"]
4588
+ });
4589
+ }
4590
+ }
4591
+ function validateNotificationForm(event2, ctx) {
4592
+ const declarationFields = getDeclarationPages(event2).flatMap(
4593
+ (page) => page.fields.map((field3) => ({ field: field3, pageId: page.id }))
4594
+ );
4595
+ event2.actions.forEach((action, actionIndex) => {
4596
+ if (action.type !== ActionType.NOTIFY) {
4597
+ return;
4598
+ }
4599
+ action.notificationForm.pages.forEach((page, pageIndex) => {
4600
+ page.fields.forEach((field3, fieldIndex) => {
4601
+ const path = [
4602
+ "actions",
4603
+ actionIndex,
4604
+ "notificationForm",
4605
+ "pages",
4606
+ pageIndex,
4607
+ "fields",
4608
+ fieldIndex
4609
+ ];
4610
+ const matchingFields = declarationFields.filter(
4611
+ (declarationField) => declarationField.field.id === field3.id
4612
+ );
4613
+ if (matchingFields.length === 0) {
4614
+ ctx.addIssue({
4615
+ code: "custom",
4616
+ 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.`,
4617
+ path
4618
+ });
4619
+ return;
4620
+ }
4621
+ if (!matchingFields.some(
4622
+ (declarationField) => declarationField.field.type === field3.type
4623
+ )) {
4624
+ const [declarationField] = matchingFields;
4625
+ ctx.addIssue({
4626
+ code: "custom",
4627
+ 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}.`,
4628
+ path
4629
+ });
4630
+ }
4631
+ });
4632
+ });
4633
+ });
4634
+ }
4472
4635
 
4473
4636
  // ../commons/src/events/EventConfig.ts
4474
4637
  var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
@@ -4493,16 +4656,15 @@ var _EventConfigBase = z35.object({
4493
4656
  summary: SummaryConfig.describe(
4494
4657
  "Summary information displayed in the event overview."
4495
4658
  ),
4496
- label: TranslationConfig.describe("Human-readable label for the event type."),
4659
+ label: TranslationConfig.describe(
4660
+ "Human-readable label for the event type."
4661
+ ),
4497
4662
  actions: z35.array(ActionConfig).describe(
4498
4663
  "Configuration of core and custom actions associated with the event."
4499
4664
  ),
4500
4665
  actionOrder: z35.array(z35.string()).optional().describe(
4501
4666
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
4502
4667
  ),
4503
- declaration: DeclarationFormConfig.describe(
4504
- "Configuration of the form used to gather event data."
4505
- ),
4506
4668
  advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
4507
4669
  "Configuration of fields available in the advanced search feature."
4508
4670
  ),
@@ -4517,6 +4679,10 @@ var _EventConfigBase = z35.object({
4517
4679
  )
4518
4680
  });
4519
4681
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
4682
+ if (!validateExactlyOneDeclareAction(event2, ctx)) {
4683
+ return;
4684
+ }
4685
+ validateNotificationForm(event2, ctx);
4520
4686
  validateAdvancedSearchConfig(event2, ctx);
4521
4687
  validateDateOfEvent(event2, ctx);
4522
4688
  validatePlaceOfEvent(event2, ctx);
@@ -4597,7 +4763,7 @@ function createSearchConfig(baseField) {
4597
4763
 
4598
4764
  // ../commons/src/event-config/event-configuration.ts
4599
4765
  function isNonSearchableEventMetadataTimeFieldId(fieldId) {
4600
- return !EventFieldIdInput.safeParse(fieldId).success;
4766
+ return !EventFieldIdInput.validate(fieldId);
4601
4767
  }
4602
4768
  function createEventFieldConfig(fieldId) {
4603
4769
  const baseField = {
@@ -4779,7 +4945,7 @@ var SerializableWithin = z37.object({
4779
4945
  });
4780
4946
  var SerializedQueryExpression = z37.object({
4781
4947
  eventType: z37.string(),
4782
- status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
4948
+ status: z37.optional(z37.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
4783
4949
  createdAt: z37.optional(DateCondition),
4784
4950
  updatedAt: z37.optional(DateCondition),
4785
4951
  "legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
@@ -4788,6 +4954,7 @@ var SerializedQueryExpression = z37.object({
4788
4954
  "legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
4789
4955
  "legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
4790
4956
  "legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
4957
+ "legalStatuses.REVOKED.createdAtLocation": z37.optional(SerializableWithin),
4791
4958
  createdAtLocation: z37.optional(
4792
4959
  z37.union([SerializableWithin, SerializableExact])
4793
4960
  ),
@@ -4927,6 +5094,12 @@ var RegisterActionInput = BaseActionInput.extend(
4927
5094
  var NotifyActionInput = BaseActionInput.extend(
4928
5095
  z39.object({
4929
5096
  type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
5097
+ declaration: BaseActionInput.shape.declaration.describe(
5098
+ "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."
5099
+ ),
5100
+ annotation: BaseActionInput.shape.annotation.describe(
5101
+ "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."
5102
+ ),
4930
5103
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4931
5104
  createdAtLocation: UUID.nullish().describe(
4932
5105
  "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."
@@ -4999,6 +5172,16 @@ var UnarchiveActionInput = BaseActionInput.extend(
4999
5172
  type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
5000
5173
  }).shape
5001
5174
  );
5175
+ var RevokeRegistrationActionInput = BaseActionInput.extend(
5176
+ z39.object({
5177
+ type: z39.literal(ActionType.REVOKE_REGISTRATION).default(ActionType.REVOKE_REGISTRATION)
5178
+ }).shape
5179
+ );
5180
+ var ReinstateRegistrationActionInput = BaseActionInput.extend(
5181
+ z39.object({
5182
+ type: z39.literal(ActionType.REINSTATE_REGISTRATION).default(ActionType.REINSTATE_REGISTRATION)
5183
+ }).shape
5184
+ );
5002
5185
  var AssignActionInput = BaseActionInput.extend(
5003
5186
  z39.object({
5004
5187
  type: z39.literal(ActionType.ASSIGN),
@@ -5061,6 +5244,12 @@ var ActionInput = z39.discriminatedUnion("type", [
5061
5244
  }),
5062
5245
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
5063
5246
  UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
5247
+ RevokeRegistrationActionInput.meta({
5248
+ id: "RevokeRegistrationActionInput"
5249
+ }),
5250
+ ReinstateRegistrationActionInput.meta({
5251
+ id: "ReinstateRegistrationActionInput"
5252
+ }),
5064
5253
  AssignActionInput.meta({ id: "AssignActionInput" }),
5065
5254
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
5066
5255
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -5136,10 +5325,61 @@ var EventDocumentOnlyLastAction = EventDocument.extend({
5136
5325
  }).brand("EventDocumentOnlyLastAction");
5137
5326
 
5138
5327
  // ../commons/src/events/defineConfig.ts
5139
- var defineConfig = (config) => {
5140
- const input = EventConfig.parse(config);
5141
- return input;
5142
- };
5328
+ var z43 = __toESM(require("zod/v4"));
5329
+ function moveDeclarationToDeclareAction({
5330
+ declaration,
5331
+ ...config
5332
+ }) {
5333
+ if (declaration) {
5334
+ console.warn(
5335
+ `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.`
5336
+ );
5337
+ }
5338
+ return {
5339
+ ...config,
5340
+ actions: config.actions.map(
5341
+ (action) => action.type === ActionType.DECLARE && declaration ? { ...action, declaration } : action
5342
+ )
5343
+ };
5344
+ }
5345
+ var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
5346
+ if (validateExactlyOneDeclareAction(config, ctx)) {
5347
+ validateDeclarationGivenExactlyOnce(config, ctx);
5348
+ }
5349
+ }).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
5350
+ var defineConfig = (config) => EventConfigDefinition.parse(config);
5351
+
5352
+ // ../commons/src/events/toNotificationForm.ts
5353
+ function toOptionalField(field3) {
5354
+ const { validation: _validation, ...rest } = field3;
5355
+ if (rest.type === FieldType.FIELD_GROUP && "fields" in rest) {
5356
+ return {
5357
+ ...rest,
5358
+ required: false,
5359
+ fields: rest.fields.map(toOptionalField)
5360
+ };
5361
+ }
5362
+ return { ...rest, required: false };
5363
+ }
5364
+ function toNotificationForm(declaration) {
5365
+ return {
5366
+ ...declaration,
5367
+ pages: declaration.pages.map((page) => ({
5368
+ ...page,
5369
+ fields: page.fields.map(
5370
+ toOptionalField
5371
+ )
5372
+ }))
5373
+ };
5374
+ }
5375
+ function toNotificationReview(review) {
5376
+ return {
5377
+ ...review,
5378
+ fields: review.fields.map(
5379
+ toOptionalField
5380
+ )
5381
+ };
5382
+ }
5143
5383
 
5144
5384
  // ../commons/src/events/test.utils.ts
5145
5385
  var import_lodash5 = require("lodash");
@@ -6448,6 +6688,8 @@ var tennisClubMembershipEvent = defineConfig({
6448
6688
  description: "This is shown as the action name anywhere the user can trigger the action from",
6449
6689
  id: "event.tennis-club-membership.action.notify.label"
6450
6690
  },
6691
+ notificationForm: toNotificationForm(TENNIS_CLUB_DECLARATION_FORM),
6692
+ review: toNotificationReview(TENNIS_CLUB_DECLARATION_REVIEW),
6451
6693
  flags: [
6452
6694
  {
6453
6695
  id: "health-worker-notified",
@@ -7125,7 +7367,24 @@ var libraryMembershipEvent = defineConfig({
7125
7367
  id: "event.library-membership.title"
7126
7368
  },
7127
7369
  summary: { fields: [] },
7128
- actions: [],
7370
+ actions: [
7371
+ {
7372
+ type: ActionType.DECLARE,
7373
+ label: {
7374
+ defaultMessage: "Declare",
7375
+ description: "This is shown as the action name anywhere the user can trigger the action from",
7376
+ id: "event.library-membership.action.declare.label"
7377
+ },
7378
+ review: {
7379
+ title: {
7380
+ defaultMessage: "Library membership application",
7381
+ description: "Title of the review page",
7382
+ id: "event.library-membership.action.declare.form.review.title"
7383
+ },
7384
+ fields: []
7385
+ }
7386
+ }
7387
+ ],
7129
7388
  declaration: libraryMembershipForm
7130
7389
  });
7131
7390
 
@@ -7571,6 +7830,22 @@ var digitalIdentityEvent = defineConfig({
7571
7830
  },
7572
7831
  summary: { fields: [] },
7573
7832
  actions: [
7833
+ {
7834
+ type: ActionType.DECLARE,
7835
+ label: {
7836
+ defaultMessage: "Declare",
7837
+ description: "This is shown as the action name anywhere the user can trigger the action from",
7838
+ id: "event.digital-identity.action.declare.label"
7839
+ },
7840
+ review: {
7841
+ title: {
7842
+ defaultMessage: "Digital identity issuance",
7843
+ description: "Title of the review page",
7844
+ id: "event.digital-identity.action.declare.form.review.title"
7845
+ },
7846
+ fields: []
7847
+ }
7848
+ },
7574
7849
  {
7575
7850
  type: ActionType.PRINT_CERTIFICATE,
7576
7851
  label: {
@@ -7585,39 +7860,39 @@ var digitalIdentityEvent = defineConfig({
7585
7860
  });
7586
7861
 
7587
7862
  // ../commons/src/events/test.utils.ts
7588
- var z44 = __toESM(require("zod/v4"));
7863
+ var z45 = __toESM(require("zod/v4"));
7589
7864
 
7590
7865
  // ../commons/src/events/locations.ts
7591
- var z43 = __toESM(require("zod/v4"));
7592
- var LocationTypeV1 = z43.enum([
7866
+ var z44 = __toESM(require("zod/v4"));
7867
+ var LocationTypeV1 = z44.enum([
7593
7868
  "ADMIN_STRUCTURE",
7594
7869
  "CRVS_OFFICE",
7595
7870
  "HEALTH_FACILITY"
7596
7871
  ]);
7597
- var LocationStatus = z43.enum(["active", "inactive"]);
7598
- var LocationVersion = z43.object({
7872
+ var LocationStatus = z44.enum(["active", "inactive"]);
7873
+ var LocationVersion = z44.object({
7599
7874
  versionId: UUID,
7600
- effectiveFrom: z43.iso.date(),
7601
- name: z43.string(),
7602
- externalId: z43.string().nullish(),
7875
+ effectiveFrom: z44.iso.date(),
7876
+ name: z44.string(),
7877
+ externalId: z44.string().nullish(),
7603
7878
  status: LocationStatus
7604
7879
  });
7605
- var AdministrativeArea = z43.object({
7880
+ var AdministrativeArea = z44.object({
7606
7881
  id: UUID,
7607
- name: z43.string(),
7608
- externalId: z43.string().nullish(),
7882
+ name: z44.string(),
7883
+ externalId: z44.string().nullish(),
7609
7884
  parentId: UUID.nullable(),
7610
7885
  status: LocationStatus,
7611
- versions: z43.array(LocationVersion)
7886
+ versions: z44.array(LocationVersion)
7612
7887
  });
7613
- var Location = z43.object({
7888
+ var Location = z44.object({
7614
7889
  id: UUID,
7615
- name: z43.string(),
7616
- externalId: z43.string().nullish(),
7890
+ name: z44.string(),
7891
+ externalId: z44.string().nullish(),
7617
7892
  administrativeAreaId: UUID.nullable(),
7618
- locationType: z43.string().nullable(),
7893
+ locationType: z44.string().nullable(),
7619
7894
  status: LocationStatus,
7620
- versions: z43.array(LocationVersion)
7895
+ versions: z44.array(LocationVersion)
7621
7896
  });
7622
7897
  var ClientAdministrativeArea = AdministrativeArea.omit({
7623
7898
  name: true,
@@ -7658,22 +7933,22 @@ function validateUniqueIds(versions, ctx) {
7658
7933
  ctx.addIssue("versions must not repeat a versionId");
7659
7934
  }
7660
7935
  }
7661
- var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
7936
+ var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
7662
7937
  validateAscendingDates(versions, ctx);
7663
7938
  validateUniqueIds(versions, ctx);
7664
7939
  });
7665
- var SetLocationPayload = z43.object({
7940
+ var SetLocationPayload = z44.object({
7666
7941
  id: UUID,
7667
- name: z43.string(),
7668
- externalId: z43.string().nullish(),
7942
+ name: z44.string(),
7943
+ externalId: z44.string().nullish(),
7669
7944
  administrativeAreaId: UUID.nullable(),
7670
- locationType: z43.string().nullable(),
7945
+ locationType: z44.string().nullable(),
7671
7946
  versions: SeededLocationVersions.optional()
7672
7947
  });
7673
- var SetAdministrativeAreaPayload = z43.object({
7948
+ var SetAdministrativeAreaPayload = z44.object({
7674
7949
  id: UUID,
7675
- name: z43.string(),
7676
- externalId: z43.string().nullish(),
7950
+ name: z44.string(),
7951
+ externalId: z44.string().nullish(),
7677
7952
  parentId: UUID.nullable(),
7678
7953
  versions: SeededLocationVersions.optional()
7679
7954
  });
@@ -8021,7 +8296,7 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
8021
8296
  );
8022
8297
 
8023
8298
  // ../commons/src/events/test.utils.ts
8024
- var TestUserRole = z44.enum([
8299
+ var TestUserRole = z45.enum([
8025
8300
  "FIELD_AGENT",
8026
8301
  "LOCAL_REGISTRAR",
8027
8302
  "LOCAL_SYSTEM_ADMIN",
@@ -8051,6 +8326,8 @@ var ACTION_SCOPE_MAP = {
8051
8326
  [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
8052
8327
  [ActionType.REJECT_CORRECTION]: ["record.correct"],
8053
8328
  [ActionType.APPROVE_CORRECTION]: ["record.correct"],
8329
+ [ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
8330
+ [ActionType.REINSTATE_REGISTRATION]: ["record.reinstate-registration"],
8054
8331
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
8055
8332
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
8056
8333
  [ActionType.ARCHIVE]: ["record.archive"],
@@ -8097,7 +8374,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8097
8374
  ActionType.APPROVE_CORRECTION,
8098
8375
  ActionType.REJECT_CORRECTION,
8099
8376
  ActionType.CUSTOM,
8100
- ClientSpecificAction.REVIEW_CORRECTION_REQUEST
8377
+ ClientSpecificAction.REVIEW_CORRECTION_REQUEST,
8378
+ ActionType.REVOKE_REGISTRATION
8379
+ ],
8380
+ [EventStatus.enum.REVOKED]: [
8381
+ ActionType.READ,
8382
+ ActionType.REINSTATE_REGISTRATION
8101
8383
  ],
8102
8384
  [EventStatus.enum.ARCHIVED]: [
8103
8385
  ActionType.READ,
@@ -8111,6 +8393,8 @@ var ACTION_FILTERS = {
8111
8393
  [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8112
8394
  [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8113
8395
  [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8396
+ [ActionType.REVOKE_REGISTRATION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8397
+ [ActionType.REINSTATE_REGISTRATION]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8114
8398
  [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8115
8399
  [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8116
8400
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
@@ -8133,55 +8417,55 @@ var REJECTED_ACTIONS = [
8133
8417
  var import_lodash7 = require("lodash");
8134
8418
 
8135
8419
  // ../commons/src/events/locationPayloads.ts
8136
- var z45 = __toESM(require("zod/v4"));
8137
- var CreateLocationPayload = z45.object({
8420
+ var z46 = __toESM(require("zod/v4"));
8421
+ var CreateLocationPayload = z46.object({
8138
8422
  id: UUID.optional(),
8139
8423
  versionId: UUID.optional(),
8140
- name: z45.string(),
8141
- externalId: z45.string().nullish(),
8424
+ name: z46.string(),
8425
+ externalId: z46.string().nullish(),
8142
8426
  administrativeAreaId: UUID.nullable(),
8143
- locationType: z45.string().nullable(),
8144
- effectiveFrom: z45.iso.date().optional(),
8427
+ locationType: z46.string().nullable(),
8428
+ effectiveFrom: z46.iso.date().optional(),
8145
8429
  status: LocationStatus.default("active")
8146
8430
  });
8147
- var UpdateLocationPayload = z45.strictObject({
8431
+ var UpdateLocationPayload = z46.strictObject({
8148
8432
  id: UUID,
8149
8433
  versionId: UUID.optional(),
8150
- name: z45.string(),
8151
- externalId: z45.string().nullish(),
8434
+ name: z46.string(),
8435
+ externalId: z46.string().nullish(),
8152
8436
  status: LocationStatus,
8153
- effectiveFrom: z45.iso.date().optional(),
8437
+ effectiveFrom: z46.iso.date().optional(),
8154
8438
  lastVersionId: UUID
8155
8439
  });
8156
- var WithdrawLocationVersionPayload = z45.object({
8440
+ var WithdrawLocationVersionPayload = z46.object({
8157
8441
  id: UUID,
8158
8442
  versionId: UUID
8159
8443
  });
8160
- var CreateAdministrativeAreaPayload = z45.object({
8444
+ var CreateAdministrativeAreaPayload = z46.object({
8161
8445
  id: UUID.optional(),
8162
8446
  versionId: UUID.optional(),
8163
- name: z45.string(),
8164
- externalId: z45.string().nullish(),
8447
+ name: z46.string(),
8448
+ externalId: z46.string().nullish(),
8165
8449
  parentId: UUID.nullable(),
8166
- effectiveFrom: z45.iso.date().optional(),
8450
+ effectiveFrom: z46.iso.date().optional(),
8167
8451
  status: LocationStatus.default("active")
8168
8452
  });
8169
- var UpdateAdministrativeAreaPayload = z45.strictObject({
8453
+ var UpdateAdministrativeAreaPayload = z46.strictObject({
8170
8454
  id: UUID,
8171
8455
  versionId: UUID.optional(),
8172
- name: z45.string(),
8173
- externalId: z45.string().nullish(),
8456
+ name: z46.string(),
8457
+ externalId: z46.string().nullish(),
8174
8458
  status: LocationStatus,
8175
- effectiveFrom: z45.iso.date().optional(),
8459
+ effectiveFrom: z46.iso.date().optional(),
8176
8460
  lastVersionId: UUID
8177
8461
  });
8178
- var WithdrawAdministrativeAreaVersionPayload = z45.object({
8462
+ var WithdrawAdministrativeAreaVersionPayload = z46.object({
8179
8463
  id: UUID,
8180
8464
  versionId: UUID
8181
8465
  });
8182
8466
 
8183
8467
  // ../commons/src/notification/UserNotifications.ts
8184
- var z46 = __toESM(require("zod/v4"));
8468
+ var z47 = __toESM(require("zod/v4"));
8185
8469
  var TriggerEvent = {
8186
8470
  USER_CREATED: "user-created",
8187
8471
  USER_UPDATED: "user-updated",
@@ -8196,60 +8480,60 @@ var TriggerEvent = {
8196
8480
  CHANGE_PHONE_NUMBER: "change-phone-number",
8197
8481
  CHANGE_EMAIL_ADDRESS: "change-email-address"
8198
8482
  };
8199
- var Recipient = z46.object({
8483
+ var Recipient = z47.object({
8200
8484
  name: NameFieldValue.optional(),
8201
- mobile: z46.string().optional(),
8202
- email: z46.string().optional(),
8203
- bcc: z46.array(z46.string()).optional()
8485
+ mobile: z47.string().optional(),
8486
+ email: z47.string().optional(),
8487
+ bcc: z47.array(z47.string()).optional()
8204
8488
  });
8205
- var BasePayload = z46.object({
8489
+ var BasePayload = z47.object({
8206
8490
  recipient: Recipient
8207
8491
  });
8208
8492
  var TriggerPayload = {
8209
8493
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
8210
- username: z46.string(),
8211
- temporaryPassword: z46.string()
8494
+ username: z47.string(),
8495
+ temporaryPassword: z47.string()
8212
8496
  }),
8213
8497
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
8214
- oldUsername: z46.string(),
8215
- newUsername: z46.string()
8498
+ oldUsername: z47.string(),
8499
+ newUsername: z47.string()
8216
8500
  }),
8217
8501
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
8218
- username: z46.string()
8502
+ username: z47.string()
8219
8503
  }),
8220
8504
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
8221
- code: z46.string()
8505
+ code: z47.string()
8222
8506
  }),
8223
8507
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
8224
- temporaryPassword: z46.string(),
8225
- admin: z46.object({
8226
- id: z46.string(),
8508
+ temporaryPassword: z47.string(),
8509
+ admin: z47.object({
8510
+ id: z47.string(),
8227
8511
  name: NameFieldValue,
8228
- role: z46.string()
8512
+ role: z47.string()
8229
8513
  })
8230
8514
  }),
8231
8515
  [TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
8232
- token: z46.string()
8516
+ token: z47.string()
8233
8517
  }),
8234
8518
  [TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
8235
- token: z46.string()
8519
+ token: z47.string()
8236
8520
  }),
8237
8521
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
8238
- username: z46.string(),
8239
- temporaryPassword: z46.string()
8522
+ username: z47.string(),
8523
+ temporaryPassword: z47.string()
8240
8524
  }),
8241
8525
  [TriggerEvent.TWO_FA]: BasePayload.extend({
8242
- code: z46.string()
8526
+ code: z47.string()
8243
8527
  }),
8244
8528
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
8245
- subject: z46.string(),
8246
- body: z46.string()
8529
+ subject: z47.string(),
8530
+ body: z47.string()
8247
8531
  }),
8248
8532
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
8249
- code: z46.string()
8533
+ code: z47.string()
8250
8534
  }),
8251
8535
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
8252
- code: z46.string()
8536
+ code: z47.string()
8253
8537
  })
8254
8538
  };
8255
8539
  function parseUserEventTrigger(event2, body) {
@@ -8352,7 +8636,7 @@ async function triggerUserEventNotification({
8352
8636
  }
8353
8637
 
8354
8638
  // src/notification/index.ts
8355
- z47.globalRegistry.clear();
8639
+ z48.globalRegistry.clear();
8356
8640
  // Annotate the CommonJS export names for ESM import in node:
8357
8641
  0 && (module.exports = {
8358
8642
  BasePayload,