@opencrvs/toolkit 2.1.0 → 2.2.0-rc.90ed9cd

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 (59) hide show
  1. package/build.sh +2 -2
  2. package/create-countryconfig/package.json +1 -1
  3. package/dist/application-config/index.js +36 -3
  4. package/dist/authentication/index.js +14 -1
  5. package/dist/cli.js +294 -1967
  6. package/dist/commons/api/router.d.ts +1374 -71
  7. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  8. package/dist/commons/events/ActionConfig.d.ts +133 -0
  9. package/dist/commons/events/ActionDocument.d.ts +88 -0
  10. package/dist/commons/events/ActionInput.d.ts +52 -0
  11. package/dist/commons/events/ActionType.d.ts +11 -1
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
  13. package/dist/commons/events/AuditLog.d.ts +4 -0
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +192 -0
  15. package/dist/commons/events/Draft.d.ts +2 -0
  16. package/dist/commons/events/EventConfig.d.ts +26 -6
  17. package/dist/commons/events/EventDocument.d.ts +88 -0
  18. package/dist/commons/events/EventIndex.d.ts +41 -0
  19. package/dist/commons/events/EventMetadata.d.ts +23 -0
  20. package/dist/commons/events/EventStatus.d.ts +1 -0
  21. package/dist/commons/events/FieldConfig.d.ts +10 -0
  22. package/dist/commons/events/WorkqueueConfig.d.ts +216 -10
  23. package/dist/commons/events/eventConfigValidation.d.ts +17 -1
  24. package/dist/commons/events/scopes.d.ts +2 -0
  25. package/dist/commons/events/state/index.d.ts +10 -2
  26. package/dist/commons/events/state/utils.d.ts +11 -1
  27. package/dist/commons/events/test.utils.d.ts +28 -1
  28. package/dist/commons/events/utils.d.ts +43 -15
  29. package/dist/conditionals/index.js +14 -1
  30. package/dist/environment/derived-variables.d.ts +18 -0
  31. package/dist/environment/derived-variables.d.ts.map +1 -1
  32. package/dist/environment/derived-variables.js +22 -1
  33. package/dist/environment/setup-environment.d.ts.map +1 -1
  34. package/dist/environment/setup-environment.js +29 -10
  35. package/dist/events/index.js +302 -68
  36. package/dist/migrations/add-translations.d.ts +15 -0
  37. package/dist/migrations/add-translations.d.ts.map +1 -0
  38. package/dist/migrations/{v2.1/add-translations.js → add-translations.js} +16 -14
  39. package/dist/migrations/v2.1/index.js +35 -2155
  40. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +3 -0
  41. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -1
  42. package/dist/migrations/v2.1/upgrade-tilt.d.ts +3 -0
  43. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -1
  44. package/dist/migrations/v2.2/index.d.ts +6 -0
  45. package/dist/migrations/v2.2/index.d.ts.map +1 -0
  46. package/dist/migrations/v2.2/index.js +456 -0
  47. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts +39 -0
  48. package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +1 -0
  49. package/dist/migrations/v2.2/read-declaration-through-helper.js +257 -0
  50. package/dist/notification/index.js +279 -88
  51. package/dist/scopes/index.d.ts +29 -6
  52. package/dist/scopes/index.js +14 -1
  53. package/dist/templates/charts-values/traefik/values.yaml +2 -3
  54. package/opencrvs-toolkit-2.2.0-rc.90ed9cd.tgz +0 -0
  55. package/package.json +1 -1
  56. package/tsconfig.build.tsbuildinfo +1 -1
  57. package/dist/migrations/v2.1/add-translations.d.ts +0 -9
  58. package/dist/migrations/v2.1/add-translations.d.ts.map +0 -1
  59. package/opencrvs-toolkit-2.1.0.tgz +0 -0
@@ -38,7 +38,7 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z47 = __toESM(require("zod/v4"));
41
+ var z48 = __toESM(require("zod/v4"));
42
42
 
43
43
  // ../commons/src/events/AuditLog.ts
44
44
  var z9 = __toESM(require("zod/v4"));
@@ -83,6 +83,8 @@ var ActionType = {
83
83
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
84
84
  REJECT_CORRECTION: "REJECT_CORRECTION",
85
85
  APPROVE_CORRECTION: "APPROVE_CORRECTION",
86
+ REVOKE_REGISTRATION: "REVOKE_REGISTRATION",
87
+ REINSTATE_REGISTRATION: "REINSTATE_REGISTRATION",
86
88
  // General actions
87
89
  READ: "READ",
88
90
  ASSIGN: "ASSIGN",
@@ -102,6 +104,8 @@ var ConfirmableActions = [
102
104
  ActionType.REQUEST_CORRECTION,
103
105
  ActionType.APPROVE_CORRECTION,
104
106
  ActionType.REJECT_CORRECTION,
107
+ ActionType.REVOKE_REGISTRATION,
108
+ ActionType.REINSTATE_REGISTRATION,
105
109
  ActionType.CUSTOM
106
110
  ];
107
111
  var ActionTypes = z2.enum([
@@ -121,6 +125,8 @@ var ActionTypes = z2.enum([
121
125
  "REQUEST_CORRECTION",
122
126
  "REJECT_CORRECTION",
123
127
  "APPROVE_CORRECTION",
128
+ "REVOKE_REGISTRATION",
129
+ "REINSTATE_REGISTRATION",
124
130
  "READ",
125
131
  "ASSIGN",
126
132
  "UNASSIGN",
@@ -162,7 +168,9 @@ var WorkqueueActionType = ActionTypes.extract([
162
168
  ActionType.ARCHIVE,
163
169
  ActionType.UNARCHIVE,
164
170
  ActionType.PRINT_CERTIFICATE,
165
- ActionType.REQUEST_CORRECTION
171
+ ActionType.REQUEST_CORRECTION,
172
+ ActionType.REVOKE_REGISTRATION,
173
+ ActionType.REINSTATE_REGISTRATION
166
174
  ]);
167
175
  var META_ACTIONS = [
168
176
  ActionType.ASSIGN,
@@ -314,6 +322,7 @@ var EventStatus = z6.enum([
314
322
  "NOTIFIED",
315
323
  "DECLARED",
316
324
  "REGISTERED",
325
+ "REVOKED",
317
326
  "ARCHIVED"
318
327
  ]);
319
328
 
@@ -337,6 +346,8 @@ var RecordScopeTypeV2 = z7.enum([
337
346
  "record.print-certified-copies",
338
347
  "record.request-correction",
339
348
  "record.correct",
349
+ "record.revoke-registration",
350
+ "record.reinstate-registration",
340
351
  "record.unassign-others",
341
352
  "record.custom-action",
342
353
  "record.action.accept",
@@ -463,6 +474,8 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
463
474
  "record.read",
464
475
  "record.request-correction",
465
476
  "record.correct",
477
+ "record.revoke-registration",
478
+ "record.reinstate-registration",
466
479
  "record.unassign-others",
467
480
  "record.review-duplicates"
468
481
  ]);
@@ -648,6 +661,8 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
648
661
  "event.actions.correction.request.request",
649
662
  "event.actions.correction.approve.request",
650
663
  "event.actions.correction.reject.request",
664
+ "event.actions.revoke_registration.request",
665
+ "event.actions.reinstate_registration.request",
651
666
  "event.actions.mark_as_duplicate.request",
652
667
  "event.actions.mark_as_not_duplicate.request"
653
668
  ]),
@@ -1391,6 +1406,16 @@ var UnarchiveAction = ActionBase.extend(
1391
1406
  type: z16.literal(ActionType.UNARCHIVE)
1392
1407
  }).shape
1393
1408
  );
1409
+ var RevokeRegistrationAction = ActionBase.extend(
1410
+ z16.object({
1411
+ type: z16.literal(ActionType.REVOKE_REGISTRATION)
1412
+ }).shape
1413
+ );
1414
+ var ReinstateRegistrationAction = ActionBase.extend(
1415
+ z16.object({
1416
+ type: z16.literal(ActionType.REINSTATE_REGISTRATION)
1417
+ }).shape
1418
+ );
1394
1419
  var CreatedAction = ActionBase.extend(
1395
1420
  z16.object({
1396
1421
  type: z16.literal(ActionType.CREATE)
@@ -1459,6 +1484,8 @@ var ActionDocument = z16.discriminatedUnion("type", [
1459
1484
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1460
1485
  ArchiveAction.meta({ id: "ArchiveAction" }),
1461
1486
  UnarchiveAction.meta({ id: "UnarchiveAction" }),
1487
+ RevokeRegistrationAction.meta({ id: "RevokeRegistrationAction" }),
1488
+ ReinstateRegistrationAction.meta({ id: "ReinstateRegistrationAction" }),
1462
1489
  NotifiedAction.meta({ id: "NotifiedAction" }),
1463
1490
  RegisterAction.meta({ id: "RegisterAction" }),
1464
1491
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1507,7 +1534,8 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1507
1534
  var LegalStatuses = z17.object({
1508
1535
  [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1509
1536
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1510
- [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1537
+ [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish(),
1538
+ [EventStatus.enum.REVOKED]: ActionCreationMetadata.nullish()
1511
1539
  });
1512
1540
  var EventMetadata = z17.object({
1513
1541
  id: UUID,
@@ -1627,6 +1655,12 @@ var AnyOfStatus = import_v4.z.object({
1627
1655
  }).meta({
1628
1656
  id: "AnyOfStatus"
1629
1657
  });
1658
+ var NoneOfStatus = import_v4.z.object({
1659
+ type: import_v4.z.literal("noneOf"),
1660
+ terms: import_v4.z.array(EventStatus)
1661
+ }).meta({
1662
+ id: "NoneOfStatus"
1663
+ });
1630
1664
  var Range = import_v4.z.object({
1631
1665
  type: import_v4.z.literal("range"),
1632
1666
  gte: import_v4.z.string(),
@@ -1667,7 +1701,7 @@ var QueryInput = import_v4.z.lazy(
1667
1701
  var QueryExpression = import_v4.z.object({
1668
1702
  id: import_v4.z.optional(import_v4.z.string()),
1669
1703
  eventType: import_v4.z.string(),
1670
- status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
1704
+ status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
1671
1705
  createdAt: import_v4.z.optional(DateCondition),
1672
1706
  updatedAt: import_v4.z.optional(DateCondition),
1673
1707
  "legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(Within).nullable(),
@@ -1676,6 +1710,7 @@ var QueryExpression = import_v4.z.object({
1676
1710
  "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1677
1711
  "legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
1678
1712
  "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
1713
+ "legalStatuses.REVOKED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1679
1714
  createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1680
1715
  updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1681
1716
  assignedTo: import_v4.z.optional(Exact),
@@ -2925,6 +2960,9 @@ var DeleteConfig = ActionConfigBase.extend(
2925
2960
  var DeclareConfig = DeclarationActionBase.extend(
2926
2961
  z25.object({
2927
2962
  type: z25.literal(ActionType.DECLARE),
2963
+ declaration: DeclarationFormConfig.describe(
2964
+ "Configuration of the form used to gather event data."
2965
+ ),
2928
2966
  review: DeclarationReviewConfig.describe(
2929
2967
  "Configuration of the review page fields."
2930
2968
  ),
@@ -2953,6 +2991,18 @@ var UnarchiveConfig = ActionConfigBase.extend(
2953
2991
  type: z25.literal(ActionType.UNARCHIVE)
2954
2992
  }).shape
2955
2993
  );
2994
+ var RevokeRegistrationConfig = ActionConfigBase.extend(
2995
+ z25.object({
2996
+ type: z25.literal(ActionType.REVOKE_REGISTRATION),
2997
+ form: actionConfirmationForm
2998
+ }).shape
2999
+ );
3000
+ var ReinstateRegistrationConfig = ActionConfigBase.extend(
3001
+ z25.object({
3002
+ type: z25.literal(ActionType.REINSTATE_REGISTRATION),
3003
+ form: actionConfirmationForm
3004
+ }).shape
3005
+ );
2956
3006
  var EditActionConfig = ActionConfigBase.extend(
2957
3007
  z25.object({
2958
3008
  type: z25.literal(ActionType.EDIT),
@@ -3093,6 +3143,14 @@ var ActionConfig = z25.discriminatedUnion("type", [
3093
3143
  id: "UnarchiveActionConfig",
3094
3144
  description: "Configuration for unarchiving a record."
3095
3145
  }),
3146
+ RevokeRegistrationConfig.meta({
3147
+ id: "RevokeRegistrationActionConfig",
3148
+ description: "Configuration for revoking a registered record."
3149
+ }),
3150
+ ReinstateRegistrationConfig.meta({
3151
+ id: "ReinstateRegistrationActionConfig",
3152
+ description: "Configuration for reinstating a revoked record back to registered."
3153
+ }),
3096
3154
  CustomActionConfig.meta({
3097
3155
  id: "CustomActionConfig",
3098
3156
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3503,6 +3561,8 @@ var updateActions = new Set(
3503
3561
  ActionType.REQUEST_CORRECTION,
3504
3562
  ActionType.APPROVE_CORRECTION,
3505
3563
  ActionType.REJECT_CORRECTION,
3564
+ ActionType.REVOKE_REGISTRATION,
3565
+ ActionType.REINSTATE_REGISTRATION,
3506
3566
  ActionType.CUSTOM
3507
3567
  ]).options
3508
3568
  );
@@ -4322,8 +4382,22 @@ function isOnline() {
4322
4382
 
4323
4383
  // ../commons/src/events/utils.ts
4324
4384
  var import_date_fns3 = require("date-fns");
4385
+ function getDeclaration(configuration) {
4386
+ const declareAction = configuration.actions.find(
4387
+ (action) => action.type === ActionType.DECLARE
4388
+ );
4389
+ if (!declareAction) {
4390
+ throw new Error(
4391
+ `Event '${configuration.id}' has no ${ActionType.DECLARE} action to read the declaration from`
4392
+ );
4393
+ }
4394
+ return declareAction.declaration;
4395
+ }
4396
+ function getDeclarationPages(configuration) {
4397
+ return getDeclaration(configuration).pages;
4398
+ }
4325
4399
  function getDeclarationFields(configuration) {
4326
- return configuration.declaration.pages.flatMap(({ fields }) => fields);
4400
+ return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
4327
4401
  }
4328
4402
  var getActionAnnotationFields = (actionConfig) => {
4329
4403
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
@@ -4469,6 +4543,43 @@ function validateActionOrder(event2, ctx) {
4469
4543
  }
4470
4544
  }
4471
4545
  }
4546
+ function validateExactlyOneDeclareAction(event2, ctx) {
4547
+ const declareActionCount = event2.actions.filter(
4548
+ (action) => action.type === ActionType.DECLARE
4549
+ ).length;
4550
+ if (declareActionCount !== 1) {
4551
+ ctx.addIssue({
4552
+ code: "custom",
4553
+ message: `Event must have exactly one ${ActionType.DECLARE} action. Found ${declareActionCount} for event ${event2.id}`,
4554
+ path: ["actions"]
4555
+ });
4556
+ return false;
4557
+ }
4558
+ return true;
4559
+ }
4560
+ function validateDeclarationGivenExactlyOnce(config, ctx) {
4561
+ const declareActionIndex = config.actions.findIndex(
4562
+ (action) => action.type === ActionType.DECLARE
4563
+ );
4564
+ const declareAction = config.actions[declareActionIndex];
4565
+ const onDeclareAction = declareAction.type === ActionType.DECLARE && !!declareAction.declaration;
4566
+ const onTopLevel = !!config.declaration;
4567
+ const declareActionPath = `actions[${declareActionIndex}].declaration`;
4568
+ if (onTopLevel && onDeclareAction) {
4569
+ ctx.addIssue({
4570
+ code: "custom",
4571
+ 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.`,
4572
+ path: ["declaration"]
4573
+ });
4574
+ }
4575
+ if (!onTopLevel && !onDeclareAction) {
4576
+ ctx.addIssue({
4577
+ code: "custom",
4578
+ message: `Event '${config.id}' does not define \`declaration\`. Define it either at the top level or on the ${ActionType.DECLARE} action (\`${declareActionPath}\`).`,
4579
+ path: ["declaration"]
4580
+ });
4581
+ }
4582
+ }
4472
4583
 
4473
4584
  // ../commons/src/events/EventConfig.ts
4474
4585
  var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
@@ -4493,16 +4604,15 @@ var _EventConfigBase = z35.object({
4493
4604
  summary: SummaryConfig.describe(
4494
4605
  "Summary information displayed in the event overview."
4495
4606
  ),
4496
- label: TranslationConfig.describe("Human-readable label for the event type."),
4607
+ label: TranslationConfig.describe(
4608
+ "Human-readable label for the event type."
4609
+ ),
4497
4610
  actions: z35.array(ActionConfig).describe(
4498
4611
  "Configuration of core and custom actions associated with the event."
4499
4612
  ),
4500
4613
  actionOrder: z35.array(z35.string()).optional().describe(
4501
4614
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
4502
4615
  ),
4503
- declaration: DeclarationFormConfig.describe(
4504
- "Configuration of the form used to gather event data."
4505
- ),
4506
4616
  advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
4507
4617
  "Configuration of fields available in the advanced search feature."
4508
4618
  ),
@@ -4517,6 +4627,9 @@ var _EventConfigBase = z35.object({
4517
4627
  )
4518
4628
  });
4519
4629
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
4630
+ if (!validateExactlyOneDeclareAction(event2, ctx)) {
4631
+ return;
4632
+ }
4520
4633
  validateAdvancedSearchConfig(event2, ctx);
4521
4634
  validateDateOfEvent(event2, ctx);
4522
4635
  validatePlaceOfEvent(event2, ctx);
@@ -4779,7 +4892,7 @@ var SerializableWithin = z37.object({
4779
4892
  });
4780
4893
  var SerializedQueryExpression = z37.object({
4781
4894
  eventType: z37.string(),
4782
- status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
4895
+ status: z37.optional(z37.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
4783
4896
  createdAt: z37.optional(DateCondition),
4784
4897
  updatedAt: z37.optional(DateCondition),
4785
4898
  "legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
@@ -4788,6 +4901,7 @@ var SerializedQueryExpression = z37.object({
4788
4901
  "legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
4789
4902
  "legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
4790
4903
  "legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
4904
+ "legalStatuses.REVOKED.createdAtLocation": z37.optional(SerializableWithin),
4791
4905
  createdAtLocation: z37.optional(
4792
4906
  z37.union([SerializableWithin, SerializableExact])
4793
4907
  ),
@@ -4999,6 +5113,16 @@ var UnarchiveActionInput = BaseActionInput.extend(
4999
5113
  type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
5000
5114
  }).shape
5001
5115
  );
5116
+ var RevokeRegistrationActionInput = BaseActionInput.extend(
5117
+ z39.object({
5118
+ type: z39.literal(ActionType.REVOKE_REGISTRATION).default(ActionType.REVOKE_REGISTRATION)
5119
+ }).shape
5120
+ );
5121
+ var ReinstateRegistrationActionInput = BaseActionInput.extend(
5122
+ z39.object({
5123
+ type: z39.literal(ActionType.REINSTATE_REGISTRATION).default(ActionType.REINSTATE_REGISTRATION)
5124
+ }).shape
5125
+ );
5002
5126
  var AssignActionInput = BaseActionInput.extend(
5003
5127
  z39.object({
5004
5128
  type: z39.literal(ActionType.ASSIGN),
@@ -5061,6 +5185,12 @@ var ActionInput = z39.discriminatedUnion("type", [
5061
5185
  }),
5062
5186
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
5063
5187
  UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
5188
+ RevokeRegistrationActionInput.meta({
5189
+ id: "RevokeRegistrationActionInput"
5190
+ }),
5191
+ ReinstateRegistrationActionInput.meta({
5192
+ id: "ReinstateRegistrationActionInput"
5193
+ }),
5064
5194
  AssignActionInput.meta({ id: "AssignActionInput" }),
5065
5195
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
5066
5196
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -5136,10 +5266,29 @@ var EventDocumentOnlyLastAction = EventDocument.extend({
5136
5266
  }).brand("EventDocumentOnlyLastAction");
5137
5267
 
5138
5268
  // ../commons/src/events/defineConfig.ts
5139
- var defineConfig = (config) => {
5140
- const input = EventConfig.parse(config);
5141
- return input;
5142
- };
5269
+ var z43 = __toESM(require("zod/v4"));
5270
+ function moveDeclarationToDeclareAction({
5271
+ declaration,
5272
+ ...config
5273
+ }) {
5274
+ if (declaration) {
5275
+ console.warn(
5276
+ `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.`
5277
+ );
5278
+ }
5279
+ return {
5280
+ ...config,
5281
+ actions: config.actions.map(
5282
+ (action) => action.type === ActionType.DECLARE && declaration ? { ...action, declaration } : action
5283
+ )
5284
+ };
5285
+ }
5286
+ var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
5287
+ if (validateExactlyOneDeclareAction(config, ctx)) {
5288
+ validateDeclarationGivenExactlyOnce(config, ctx);
5289
+ }
5290
+ }).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
5291
+ var defineConfig = (config) => EventConfigDefinition.parse(config);
5143
5292
 
5144
5293
  // ../commons/src/events/test.utils.ts
5145
5294
  var import_lodash5 = require("lodash");
@@ -7125,7 +7274,24 @@ var libraryMembershipEvent = defineConfig({
7125
7274
  id: "event.library-membership.title"
7126
7275
  },
7127
7276
  summary: { fields: [] },
7128
- actions: [],
7277
+ actions: [
7278
+ {
7279
+ type: ActionType.DECLARE,
7280
+ label: {
7281
+ defaultMessage: "Declare",
7282
+ description: "This is shown as the action name anywhere the user can trigger the action from",
7283
+ id: "event.library-membership.action.declare.label"
7284
+ },
7285
+ review: {
7286
+ title: {
7287
+ defaultMessage: "Library membership application",
7288
+ description: "Title of the review page",
7289
+ id: "event.library-membership.action.declare.form.review.title"
7290
+ },
7291
+ fields: []
7292
+ }
7293
+ }
7294
+ ],
7129
7295
  declaration: libraryMembershipForm
7130
7296
  });
7131
7297
 
@@ -7571,6 +7737,22 @@ var digitalIdentityEvent = defineConfig({
7571
7737
  },
7572
7738
  summary: { fields: [] },
7573
7739
  actions: [
7740
+ {
7741
+ type: ActionType.DECLARE,
7742
+ label: {
7743
+ defaultMessage: "Declare",
7744
+ description: "This is shown as the action name anywhere the user can trigger the action from",
7745
+ id: "event.digital-identity.action.declare.label"
7746
+ },
7747
+ review: {
7748
+ title: {
7749
+ defaultMessage: "Digital identity issuance",
7750
+ description: "Title of the review page",
7751
+ id: "event.digital-identity.action.declare.form.review.title"
7752
+ },
7753
+ fields: []
7754
+ }
7755
+ },
7574
7756
  {
7575
7757
  type: ActionType.PRINT_CERTIFICATE,
7576
7758
  label: {
@@ -7585,39 +7767,39 @@ var digitalIdentityEvent = defineConfig({
7585
7767
  });
7586
7768
 
7587
7769
  // ../commons/src/events/test.utils.ts
7588
- var z44 = __toESM(require("zod/v4"));
7770
+ var z45 = __toESM(require("zod/v4"));
7589
7771
 
7590
7772
  // ../commons/src/events/locations.ts
7591
- var z43 = __toESM(require("zod/v4"));
7592
- var LocationTypeV1 = z43.enum([
7773
+ var z44 = __toESM(require("zod/v4"));
7774
+ var LocationTypeV1 = z44.enum([
7593
7775
  "ADMIN_STRUCTURE",
7594
7776
  "CRVS_OFFICE",
7595
7777
  "HEALTH_FACILITY"
7596
7778
  ]);
7597
- var LocationStatus = z43.enum(["active", "inactive"]);
7598
- var LocationVersion = z43.object({
7779
+ var LocationStatus = z44.enum(["active", "inactive"]);
7780
+ var LocationVersion = z44.object({
7599
7781
  versionId: UUID,
7600
- effectiveFrom: z43.iso.date(),
7601
- name: z43.string(),
7602
- externalId: z43.string().nullish(),
7782
+ effectiveFrom: z44.iso.date(),
7783
+ name: z44.string(),
7784
+ externalId: z44.string().nullish(),
7603
7785
  status: LocationStatus
7604
7786
  });
7605
- var AdministrativeArea = z43.object({
7787
+ var AdministrativeArea = z44.object({
7606
7788
  id: UUID,
7607
- name: z43.string(),
7608
- externalId: z43.string().nullish(),
7789
+ name: z44.string(),
7790
+ externalId: z44.string().nullish(),
7609
7791
  parentId: UUID.nullable(),
7610
7792
  status: LocationStatus,
7611
- versions: z43.array(LocationVersion)
7793
+ versions: z44.array(LocationVersion)
7612
7794
  });
7613
- var Location = z43.object({
7795
+ var Location = z44.object({
7614
7796
  id: UUID,
7615
- name: z43.string(),
7616
- externalId: z43.string().nullish(),
7797
+ name: z44.string(),
7798
+ externalId: z44.string().nullish(),
7617
7799
  administrativeAreaId: UUID.nullable(),
7618
- locationType: z43.string().nullable(),
7800
+ locationType: z44.string().nullable(),
7619
7801
  status: LocationStatus,
7620
- versions: z43.array(LocationVersion)
7802
+ versions: z44.array(LocationVersion)
7621
7803
  });
7622
7804
  var ClientAdministrativeArea = AdministrativeArea.omit({
7623
7805
  name: true,
@@ -7658,22 +7840,22 @@ function validateUniqueIds(versions, ctx) {
7658
7840
  ctx.addIssue("versions must not repeat a versionId");
7659
7841
  }
7660
7842
  }
7661
- var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
7843
+ var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
7662
7844
  validateAscendingDates(versions, ctx);
7663
7845
  validateUniqueIds(versions, ctx);
7664
7846
  });
7665
- var SetLocationPayload = z43.object({
7847
+ var SetLocationPayload = z44.object({
7666
7848
  id: UUID,
7667
- name: z43.string(),
7668
- externalId: z43.string().nullish(),
7849
+ name: z44.string(),
7850
+ externalId: z44.string().nullish(),
7669
7851
  administrativeAreaId: UUID.nullable(),
7670
- locationType: z43.string().nullable(),
7852
+ locationType: z44.string().nullable(),
7671
7853
  versions: SeededLocationVersions.optional()
7672
7854
  });
7673
- var SetAdministrativeAreaPayload = z43.object({
7855
+ var SetAdministrativeAreaPayload = z44.object({
7674
7856
  id: UUID,
7675
- name: z43.string(),
7676
- externalId: z43.string().nullish(),
7857
+ name: z44.string(),
7858
+ externalId: z44.string().nullish(),
7677
7859
  parentId: UUID.nullable(),
7678
7860
  versions: SeededLocationVersions.optional()
7679
7861
  });
@@ -8021,7 +8203,7 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
8021
8203
  );
8022
8204
 
8023
8205
  // ../commons/src/events/test.utils.ts
8024
- var TestUserRole = z44.enum([
8206
+ var TestUserRole = z45.enum([
8025
8207
  "FIELD_AGENT",
8026
8208
  "LOCAL_REGISTRAR",
8027
8209
  "LOCAL_SYSTEM_ADMIN",
@@ -8051,6 +8233,8 @@ var ACTION_SCOPE_MAP = {
8051
8233
  [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
8052
8234
  [ActionType.REJECT_CORRECTION]: ["record.correct"],
8053
8235
  [ActionType.APPROVE_CORRECTION]: ["record.correct"],
8236
+ [ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
8237
+ [ActionType.REINSTATE_REGISTRATION]: ["record.reinstate-registration"],
8054
8238
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
8055
8239
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
8056
8240
  [ActionType.ARCHIVE]: ["record.archive"],
@@ -8097,7 +8281,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8097
8281
  ActionType.APPROVE_CORRECTION,
8098
8282
  ActionType.REJECT_CORRECTION,
8099
8283
  ActionType.CUSTOM,
8100
- ClientSpecificAction.REVIEW_CORRECTION_REQUEST
8284
+ ClientSpecificAction.REVIEW_CORRECTION_REQUEST,
8285
+ ActionType.REVOKE_REGISTRATION
8286
+ ],
8287
+ [EventStatus.enum.REVOKED]: [
8288
+ ActionType.READ,
8289
+ ActionType.REINSTATE_REGISTRATION
8101
8290
  ],
8102
8291
  [EventStatus.enum.ARCHIVED]: [
8103
8292
  ActionType.READ,
@@ -8111,6 +8300,8 @@ var ACTION_FILTERS = {
8111
8300
  [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8112
8301
  [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8113
8302
  [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8303
+ [ActionType.REVOKE_REGISTRATION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8304
+ [ActionType.REINSTATE_REGISTRATION]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8114
8305
  [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8115
8306
  [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8116
8307
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
@@ -8133,55 +8324,55 @@ var REJECTED_ACTIONS = [
8133
8324
  var import_lodash7 = require("lodash");
8134
8325
 
8135
8326
  // ../commons/src/events/locationPayloads.ts
8136
- var z45 = __toESM(require("zod/v4"));
8137
- var CreateLocationPayload = z45.object({
8327
+ var z46 = __toESM(require("zod/v4"));
8328
+ var CreateLocationPayload = z46.object({
8138
8329
  id: UUID.optional(),
8139
8330
  versionId: UUID.optional(),
8140
- name: z45.string(),
8141
- externalId: z45.string().nullish(),
8331
+ name: z46.string(),
8332
+ externalId: z46.string().nullish(),
8142
8333
  administrativeAreaId: UUID.nullable(),
8143
- locationType: z45.string().nullable(),
8144
- effectiveFrom: z45.iso.date().optional(),
8334
+ locationType: z46.string().nullable(),
8335
+ effectiveFrom: z46.iso.date().optional(),
8145
8336
  status: LocationStatus.default("active")
8146
8337
  });
8147
- var UpdateLocationPayload = z45.strictObject({
8338
+ var UpdateLocationPayload = z46.strictObject({
8148
8339
  id: UUID,
8149
8340
  versionId: UUID.optional(),
8150
- name: z45.string(),
8151
- externalId: z45.string().nullish(),
8341
+ name: z46.string(),
8342
+ externalId: z46.string().nullish(),
8152
8343
  status: LocationStatus,
8153
- effectiveFrom: z45.iso.date().optional(),
8344
+ effectiveFrom: z46.iso.date().optional(),
8154
8345
  lastVersionId: UUID
8155
8346
  });
8156
- var WithdrawLocationVersionPayload = z45.object({
8347
+ var WithdrawLocationVersionPayload = z46.object({
8157
8348
  id: UUID,
8158
8349
  versionId: UUID
8159
8350
  });
8160
- var CreateAdministrativeAreaPayload = z45.object({
8351
+ var CreateAdministrativeAreaPayload = z46.object({
8161
8352
  id: UUID.optional(),
8162
8353
  versionId: UUID.optional(),
8163
- name: z45.string(),
8164
- externalId: z45.string().nullish(),
8354
+ name: z46.string(),
8355
+ externalId: z46.string().nullish(),
8165
8356
  parentId: UUID.nullable(),
8166
- effectiveFrom: z45.iso.date().optional(),
8357
+ effectiveFrom: z46.iso.date().optional(),
8167
8358
  status: LocationStatus.default("active")
8168
8359
  });
8169
- var UpdateAdministrativeAreaPayload = z45.strictObject({
8360
+ var UpdateAdministrativeAreaPayload = z46.strictObject({
8170
8361
  id: UUID,
8171
8362
  versionId: UUID.optional(),
8172
- name: z45.string(),
8173
- externalId: z45.string().nullish(),
8363
+ name: z46.string(),
8364
+ externalId: z46.string().nullish(),
8174
8365
  status: LocationStatus,
8175
- effectiveFrom: z45.iso.date().optional(),
8366
+ effectiveFrom: z46.iso.date().optional(),
8176
8367
  lastVersionId: UUID
8177
8368
  });
8178
- var WithdrawAdministrativeAreaVersionPayload = z45.object({
8369
+ var WithdrawAdministrativeAreaVersionPayload = z46.object({
8179
8370
  id: UUID,
8180
8371
  versionId: UUID
8181
8372
  });
8182
8373
 
8183
8374
  // ../commons/src/notification/UserNotifications.ts
8184
- var z46 = __toESM(require("zod/v4"));
8375
+ var z47 = __toESM(require("zod/v4"));
8185
8376
  var TriggerEvent = {
8186
8377
  USER_CREATED: "user-created",
8187
8378
  USER_UPDATED: "user-updated",
@@ -8196,60 +8387,60 @@ var TriggerEvent = {
8196
8387
  CHANGE_PHONE_NUMBER: "change-phone-number",
8197
8388
  CHANGE_EMAIL_ADDRESS: "change-email-address"
8198
8389
  };
8199
- var Recipient = z46.object({
8390
+ var Recipient = z47.object({
8200
8391
  name: NameFieldValue.optional(),
8201
- mobile: z46.string().optional(),
8202
- email: z46.string().optional(),
8203
- bcc: z46.array(z46.string()).optional()
8392
+ mobile: z47.string().optional(),
8393
+ email: z47.string().optional(),
8394
+ bcc: z47.array(z47.string()).optional()
8204
8395
  });
8205
- var BasePayload = z46.object({
8396
+ var BasePayload = z47.object({
8206
8397
  recipient: Recipient
8207
8398
  });
8208
8399
  var TriggerPayload = {
8209
8400
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
8210
- username: z46.string(),
8211
- temporaryPassword: z46.string()
8401
+ username: z47.string(),
8402
+ temporaryPassword: z47.string()
8212
8403
  }),
8213
8404
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
8214
- oldUsername: z46.string(),
8215
- newUsername: z46.string()
8405
+ oldUsername: z47.string(),
8406
+ newUsername: z47.string()
8216
8407
  }),
8217
8408
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
8218
- username: z46.string()
8409
+ username: z47.string()
8219
8410
  }),
8220
8411
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
8221
- code: z46.string()
8412
+ code: z47.string()
8222
8413
  }),
8223
8414
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
8224
- temporaryPassword: z46.string(),
8225
- admin: z46.object({
8226
- id: z46.string(),
8415
+ temporaryPassword: z47.string(),
8416
+ admin: z47.object({
8417
+ id: z47.string(),
8227
8418
  name: NameFieldValue,
8228
- role: z46.string()
8419
+ role: z47.string()
8229
8420
  })
8230
8421
  }),
8231
8422
  [TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
8232
- token: z46.string()
8423
+ token: z47.string()
8233
8424
  }),
8234
8425
  [TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
8235
- token: z46.string()
8426
+ token: z47.string()
8236
8427
  }),
8237
8428
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
8238
- username: z46.string(),
8239
- temporaryPassword: z46.string()
8429
+ username: z47.string(),
8430
+ temporaryPassword: z47.string()
8240
8431
  }),
8241
8432
  [TriggerEvent.TWO_FA]: BasePayload.extend({
8242
- code: z46.string()
8433
+ code: z47.string()
8243
8434
  }),
8244
8435
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
8245
- subject: z46.string(),
8246
- body: z46.string()
8436
+ subject: z47.string(),
8437
+ body: z47.string()
8247
8438
  }),
8248
8439
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
8249
- code: z46.string()
8440
+ code: z47.string()
8250
8441
  }),
8251
8442
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
8252
- code: z46.string()
8443
+ code: z47.string()
8253
8444
  })
8254
8445
  };
8255
8446
  function parseUserEventTrigger(event2, body) {
@@ -8352,7 +8543,7 @@ async function triggerUserEventNotification({
8352
8543
  }
8353
8544
 
8354
8545
  // src/notification/index.ts
8355
- z47.globalRegistry.clear();
8546
+ z48.globalRegistry.clear();
8356
8547
  // Annotate the CommonJS export names for ESM import in node:
8357
8548
  0 && (module.exports = {
8358
8549
  BasePayload,