@opencrvs/toolkit 2.0.0-rc.147ca01 → 2.0.0-rc.1498d58

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 (107) hide show
  1. package/README.md +15 -0
  2. package/build.sh +5 -4
  3. package/dist/application-config/index.js +35 -6
  4. package/dist/cli.js +3186 -4921
  5. package/dist/commons/api/router.d.ts +634 -22
  6. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  7. package/dist/commons/events/ActionConfig.d.ts +230 -2
  8. package/dist/commons/events/ActionDocument.d.ts +44 -0
  9. package/dist/commons/events/ActionInput.d.ts +26 -0
  10. package/dist/commons/events/ActionType.d.ts +6 -1
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -0
  12. package/dist/commons/events/AuditLog.d.ts +2 -0
  13. package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
  14. package/dist/commons/events/Draft.d.ts +2 -0
  15. package/dist/commons/events/EventConfig.d.ts +2 -0
  16. package/dist/commons/events/EventDocument.d.ts +22 -0
  17. package/dist/commons/events/EventIndex.d.ts +25 -0
  18. package/dist/commons/events/EventMetadata.d.ts +26 -0
  19. package/dist/commons/events/FieldConfig.d.ts +16 -0
  20. package/dist/commons/events/FieldType.d.ts +1 -0
  21. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  22. package/dist/commons/events/WorkqueueConfig.d.ts +44 -2
  23. package/dist/commons/events/locations.d.ts +1 -0
  24. package/dist/commons/events/scopes.d.ts +1 -0
  25. package/dist/commons/events/state/index.d.ts +8 -0
  26. package/dist/commons/events/state/utils.d.ts +9 -0
  27. package/dist/commons/events/test.utils.d.ts +9 -1
  28. package/dist/commons/events/utils.d.ts +15 -1
  29. package/dist/conditionals/index.js +12 -5
  30. package/dist/environment/custom-types.d.ts +33 -0
  31. package/dist/environment/custom-types.d.ts.map +1 -0
  32. package/dist/environment/custom-types.js +12 -0
  33. package/dist/environment/derived-variables.d.ts +134 -0
  34. package/dist/environment/derived-variables.d.ts.map +1 -0
  35. package/dist/environment/derived-variables.js +169 -0
  36. package/dist/environment/editor-questions.d.ts +4 -0
  37. package/dist/environment/editor-questions.d.ts.map +1 -0
  38. package/dist/environment/editor-questions.js +67 -0
  39. package/dist/environment/git.d.ts +5 -0
  40. package/dist/environment/git.d.ts.map +1 -0
  41. package/dist/environment/git.js +38 -0
  42. package/dist/environment/github.d.ts +26 -0
  43. package/dist/environment/github.d.ts.map +1 -0
  44. package/dist/environment/github.js +247 -0
  45. package/dist/environment/index.d.ts +5 -0
  46. package/dist/environment/index.d.ts.map +1 -0
  47. package/dist/environment/index.js +71 -0
  48. package/dist/environment/logger.d.ts +15 -0
  49. package/dist/environment/logger.d.ts.map +1 -0
  50. package/dist/environment/logger.js +25 -0
  51. package/dist/environment/manage-users.d.ts +11 -0
  52. package/dist/environment/manage-users.d.ts.map +1 -0
  53. package/dist/environment/manage-users.js +497 -0
  54. package/dist/environment/questions-helper.d.ts +15 -0
  55. package/dist/environment/questions-helper.d.ts.map +1 -0
  56. package/dist/environment/questions-helper.js +70 -0
  57. package/dist/environment/questions.d.ts +199 -0
  58. package/dist/environment/questions.d.ts.map +1 -0
  59. package/dist/environment/questions.js +412 -0
  60. package/dist/environment/setup-environment.d.ts +2 -0
  61. package/dist/environment/setup-environment.d.ts.map +1 -0
  62. package/dist/environment/setup-environment.js +794 -0
  63. package/dist/environment/ssh-keygen.d.ts +5 -0
  64. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  65. package/dist/environment/ssh-keygen.js +21 -0
  66. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  67. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  68. package/dist/environment/swarm-to-k8s.js +173 -0
  69. package/dist/environment/templates.d.ts +27 -0
  70. package/dist/environment/templates.d.ts.map +1 -0
  71. package/dist/environment/templates.js +163 -0
  72. package/dist/environment/update-workflows.d.ts +2 -0
  73. package/dist/environment/update-workflows.d.ts.map +1 -0
  74. package/dist/environment/update-workflows.js +169 -0
  75. package/dist/environment/users.d.ts +2 -0
  76. package/dist/environment/users.d.ts.map +1 -0
  77. package/dist/environment/users.js +112 -0
  78. package/dist/environment/utils.d.ts +18 -0
  79. package/dist/environment/utils.d.ts.map +1 -0
  80. package/dist/environment/utils.js +100 -0
  81. package/dist/events/index.js +351 -78
  82. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  83. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  84. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  85. package/dist/migrations/v2.0/index.js +88 -5139
  86. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  87. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  88. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  89. package/dist/migrations/v2.1/index.d.ts +6 -0
  90. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  91. package/dist/migrations/v2.1/index.js +218 -0
  92. package/dist/notification/index.js +236 -12
  93. package/dist/scopes/index.d.ts +96 -2
  94. package/dist/scopes/index.js +12 -5
  95. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  96. package/dist/templates/charts-values/dependencies/values.yaml +83 -0
  97. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  98. package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
  99. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  100. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  101. package/dist/templates/inventory/inventory.template.yml +100 -0
  102. package/dist/templates/inventory/production.example.yml +77 -0
  103. package/dist/templates/inventory/qa.example.yml +48 -0
  104. package/opencrvs-toolkit-2.0.0-rc.1498d58.tgz +0 -0
  105. package/package.json +15 -1
  106. package/tsconfig.tsbuildinfo +1 -1
  107. package/opencrvs-toolkit-2.0.0-rc.147ca01.tgz +0 -0
@@ -79,6 +79,7 @@ var RecordScopeTypeV2 = z2.enum([
79
79
  "record.edit",
80
80
  "record.reject",
81
81
  "record.archive",
82
+ "record.unarchive",
82
83
  "record.review-duplicates",
83
84
  "record.register",
84
85
  "record.print-certified-copies",
@@ -118,11 +119,13 @@ var scopeOptionsPlaceEvent = z2.object({
118
119
  event: scopeByEvent,
119
120
  placeOfEvent: JurisdictionFilter.optional()
120
121
  }).describe("Options applicable to all record scopes.");
121
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
122
+ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
123
+ notifiedIn: JurisdictionFilter.optional(),
124
+ notifiedBy: UserFilter.optional(),
122
125
  declaredIn: JurisdictionFilter.optional(),
123
126
  declaredBy: UserFilter.optional()
124
127
  }).describe("Options applicable to actions that may take place after DECLARE");
125
- var AllRecordScopeOptions = scopeOptionsDeclared.extend({
128
+ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
126
129
  registeredIn: JurisdictionFilter.optional(),
127
130
  registeredBy: UserFilter.optional()
128
131
  }).describe(
@@ -160,6 +163,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
160
163
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
161
164
  );
162
165
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
166
+ notifiedIn: UUID.nullish(),
167
+ notifiedBy: z2.string().optional(),
163
168
  declaredIn: UUID.nullish(),
164
169
  declaredBy: z2.string().optional()
165
170
  }).describe(
@@ -180,6 +185,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
180
185
  "record.edit",
181
186
  "record.reject",
182
187
  "record.archive",
188
+ "record.unarchive",
183
189
  "record.review-duplicates",
184
190
  "record.register"
185
191
  ]);
@@ -205,7 +211,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
205
211
  }),
206
212
  z2.object({
207
213
  type: ScopesWithDeclaredOptions,
208
- options: scopeOptionsDeclared.optional()
214
+ options: scopeOptionsDeclaredOrNotified.optional()
209
215
  }),
210
216
  z2.object({
211
217
  type: ScopesWithFullOptions,
@@ -294,8 +300,9 @@ var EncodedScope = z2.string().brand("EncodedScope");
294
300
  var DEFAULT_SCOPE_OPTIONS = {
295
301
  placeOfEvent: JurisdictionFilter.enum.all,
296
302
  accessLevel: JurisdictionFilter.enum.all,
297
- registeredIn: JurisdictionFilter.enum.all,
298
- declaredIn: JurisdictionFilter.enum.all
303
+ notifiedIn: JurisdictionFilter.enum.all,
304
+ declaredIn: JurisdictionFilter.enum.all,
305
+ registeredIn: JurisdictionFilter.enum.all
299
306
  };
300
307
 
301
308
  // ../commons/src/authentication.ts
@@ -320,6 +327,7 @@ var ActionType = {
320
327
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
321
328
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
322
329
  ARCHIVE: "ARCHIVE",
330
+ UNARCHIVE: "UNARCHIVE",
323
331
  // Record actions
324
332
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
325
333
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -339,6 +347,7 @@ var ConfirmableActions = [
339
347
  ActionType.REGISTER,
340
348
  ActionType.REJECT,
341
349
  ActionType.ARCHIVE,
350
+ ActionType.UNARCHIVE,
342
351
  ActionType.PRINT_CERTIFICATE,
343
352
  ActionType.REQUEST_CORRECTION,
344
353
  ActionType.APPROVE_CORRECTION,
@@ -357,6 +366,7 @@ var ActionTypes = z4.enum([
357
366
  "MARK_AS_DUPLICATE",
358
367
  "MARK_AS_NOT_DUPLICATE",
359
368
  "ARCHIVE",
369
+ "UNARCHIVE",
360
370
  "PRINT_CERTIFICATE",
361
371
  "REQUEST_CORRECTION",
362
372
  "REJECT_CORRECTION",
@@ -400,6 +410,7 @@ var WorkqueueActionType = ActionTypes.extract([
400
410
  ActionType.REJECT,
401
411
  ActionType.MARK_AS_DUPLICATE,
402
412
  ActionType.ARCHIVE,
413
+ ActionType.UNARCHIVE,
403
414
  ActionType.PRINT_CERTIFICATE,
404
415
  ActionType.REQUEST_CORRECTION
405
416
  ]);
@@ -461,6 +472,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
461
472
  "event.actions.unassign.request",
462
473
  "event.actions.read.request",
463
474
  "event.actions.archive.request",
475
+ "event.actions.unarchive.request",
464
476
  "event.actions.reinstate.request",
465
477
  "event.actions.print_certificate.request",
466
478
  "event.actions.correction.request.request",
@@ -770,6 +782,11 @@ var FieldTypesToHideInReview = [
770
782
  FieldType.ALPHA_PRINT_BUTTON,
771
783
  FieldType.ALPHA_HIDDEN
772
784
  ];
785
+ var HiddenFieldTypes = [
786
+ FieldType.HTTP,
787
+ FieldType.QUERY_PARAM_READER,
788
+ FieldType.ALPHA_HIDDEN
789
+ ];
773
790
 
774
791
  // ../commons/src/events/FieldValue.ts
775
792
  var z12 = __toESM(require("zod/v4"));
@@ -1181,6 +1198,11 @@ var ArchiveAction = ActionBase.extend(
1181
1198
  content: ReasonContent
1182
1199
  }).shape
1183
1200
  );
1201
+ var UnarchiveAction = ActionBase.extend(
1202
+ z14.object({
1203
+ type: z14.literal(ActionType.UNARCHIVE)
1204
+ }).shape
1205
+ );
1184
1206
  var CreatedAction = ActionBase.extend(
1185
1207
  z14.object({
1186
1208
  type: z14.literal(ActionType.CREATE)
@@ -1247,6 +1269,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1247
1269
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1248
1270
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1249
1271
  ArchiveAction.meta({ id: "ArchiveAction" }),
1272
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1250
1273
  NotifiedAction.meta({ id: "NotifiedAction" }),
1251
1274
  RegisterAction.meta({ id: "RegisterAction" }),
1252
1275
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1352,6 +1375,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1352
1375
  )
1353
1376
  });
1354
1377
  var LegalStatuses = z16.object({
1378
+ [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1355
1379
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1356
1380
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1357
1381
  });
@@ -1411,6 +1435,8 @@ var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
1411
1435
  var EventMetadataDateFieldIdInput = z16.enum([
1412
1436
  "createdAt",
1413
1437
  "updatedAt",
1438
+ "legalStatuses.NOTIFIED.createdAt",
1439
+ "legalStatuses.NOTIFIED.acceptedAt",
1414
1440
  "legalStatuses.DECLARED.createdAt",
1415
1441
  "legalStatuses.DECLARED.acceptedAt",
1416
1442
  "legalStatuses.REGISTERED.createdAt",
@@ -1419,6 +1445,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
1419
1445
  var EventMetadataDateFieldId = z16.enum([
1420
1446
  "event.createdAt",
1421
1447
  "event.updatedAt",
1448
+ "event.legalStatuses.NOTIFIED.createdAt",
1449
+ "event.legalStatuses.NOTIFIED.acceptedAt",
1422
1450
  "event.legalStatuses.DECLARED.createdAt",
1423
1451
  "event.legalStatuses.DECLARED.acceptedAt",
1424
1452
  "event.legalStatuses.REGISTERED.createdAt",
@@ -1478,7 +1506,8 @@ var Range = import_v4.z.object({
1478
1506
  });
1479
1507
  var ContainsFlags = import_v4.z.object({
1480
1508
  anyOf: import_v4.z.array(Flag).optional(),
1481
- noneOf: import_v4.z.array(Flag).optional()
1509
+ noneOf: import_v4.z.array(Flag).optional(),
1510
+ allOf: import_v4.z.array(Flag).optional()
1482
1511
  }).meta({
1483
1512
  id: "ContainsFlags"
1484
1513
  });
@@ -1750,6 +1779,7 @@ var NumberField = BaseField.extend({
1750
1779
  configuration: import_v43.default.object({
1751
1780
  min: import_v43.default.number().optional().describe("Minimum value"),
1752
1781
  max: import_v43.default.number().optional().describe("Maximum value"),
1782
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1753
1783
  prefix: TranslationConfig.optional(),
1754
1784
  postfix: TranslationConfig.optional()
1755
1785
  }).optional()
@@ -2673,6 +2703,57 @@ var ReadActionConfig = ActionConfigBase.extend(
2673
2703
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2674
2704
  }).shape
2675
2705
  );
2706
+ var NotifyConfig = ActionConfigBase.extend(
2707
+ z24.object({
2708
+ type: z24.literal(ActionType.NOTIFY)
2709
+ }).shape
2710
+ );
2711
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
2712
+ z24.object({
2713
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2714
+ label: z24.never().optional().describe(
2715
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2716
+ ),
2717
+ supportingCopy: z24.never().optional(),
2718
+ icon: z24.never().optional().describe(
2719
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2720
+ ),
2721
+ conditionals: z24.never().optional().describe(
2722
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2723
+ )
2724
+ }).shape
2725
+ );
2726
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2727
+ z24.object({
2728
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2729
+ }).shape
2730
+ );
2731
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2732
+ z24.object({
2733
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2734
+ }).shape
2735
+ );
2736
+ var AssignConfig = ActionConfigBase.extend(
2737
+ z24.object({
2738
+ type: z24.literal(ActionType.ASSIGN),
2739
+ flags: z24.never().optional().describe(
2740
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2741
+ )
2742
+ }).shape
2743
+ );
2744
+ var UnassignConfig = ActionConfigBase.extend(
2745
+ z24.object({
2746
+ type: z24.literal(ActionType.UNASSIGN),
2747
+ flags: z24.never().optional().describe(
2748
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2749
+ )
2750
+ }).shape
2751
+ );
2752
+ var DeleteConfig = ActionConfigBase.extend(
2753
+ z24.object({
2754
+ type: z24.literal(ActionType.DELETE)
2755
+ }).shape
2756
+ );
2676
2757
  var DeclareConfig = DeclarationActionBase.extend(
2677
2758
  z24.object({
2678
2759
  type: z24.literal(ActionType.DECLARE),
@@ -2697,6 +2778,11 @@ var ArchiveConfig = ActionConfigBase.extend(
2697
2778
  type: z24.literal(ActionType.ARCHIVE)
2698
2779
  }).shape
2699
2780
  );
2781
+ var UnarchiveConfig = ActionConfigBase.extend(
2782
+ z24.object({
2783
+ type: z24.literal(ActionType.UNARCHIVE)
2784
+ }).shape
2785
+ );
2700
2786
  var EditActionConfig = ActionConfigBase.extend(
2701
2787
  z24.object({
2702
2788
  type: z24.literal(ActionType.EDIT),
@@ -2735,7 +2821,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2735
2821
  correctionForm: ActionFormConfig
2736
2822
  }).shape
2737
2823
  );
2738
- var CustomActionConfig = ActionConfigBase.merge(
2824
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2825
+ z24.object({
2826
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2827
+ }).shape
2828
+ );
2829
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2830
+ z24.object({
2831
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2832
+ }).shape
2833
+ );
2834
+ var CustomActionConfig = ActionConfigBase.extend(
2739
2835
  z24.object({
2740
2836
  type: z24.literal(ActionType.CUSTOM),
2741
2837
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2746,7 +2842,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2746
2842
  auditHistoryLabel: TranslationConfig.describe(
2747
2843
  'The label to show in audit history for this action. For example "Approved".'
2748
2844
  )
2749
- })
2845
+ }).shape
2750
2846
  );
2751
2847
  var ActionConfig = z24.discriminatedUnion("type", [
2752
2848
  /*
@@ -2757,9 +2853,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
2757
2853
  id: "ReadActionConfig",
2758
2854
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2759
2855
  }),
2856
+ AssignConfig.meta({
2857
+ id: "AssignActionConfig",
2858
+ description: "Configuration for assigning a record to the current user."
2859
+ }),
2860
+ UnassignConfig.meta({
2861
+ id: "UnassignActionConfig",
2862
+ description: "Configuration for unassigning a record from its current assignee."
2863
+ }),
2864
+ DeleteConfig.meta({
2865
+ id: "DeleteActionConfig",
2866
+ description: "Configuration for deleting a draft record."
2867
+ }),
2868
+ NotifyConfig.meta({
2869
+ id: "NotifyActionConfig",
2870
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2871
+ }),
2760
2872
  DeclareConfig.meta({
2761
2873
  id: "DeclareActionConfig",
2762
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2874
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2875
+ }),
2876
+ DuplicateDetectedConfig.meta({
2877
+ id: "DuplicateDetectedActionConfig",
2878
+ description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
2879
+ }),
2880
+ MarkAsDuplicateConfig.meta({
2881
+ id: "MarkAsDuplicateActionConfig",
2882
+ description: "Configuration for marking a record as a duplicate."
2883
+ }),
2884
+ MarkAsNotDuplicateConfig.meta({
2885
+ id: "MarkAsNotDuplicateActionConfig",
2886
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2763
2887
  }),
2764
2888
  RejectConfig.meta({
2765
2889
  id: "RejectActionConfig",
@@ -2777,6 +2901,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2777
2901
  id: "RequestCorrectionActionConfig",
2778
2902
  description: "Configuration for requesting a correction on a registered record."
2779
2903
  }),
2904
+ ApproveCorrectionConfig.meta({
2905
+ id: "ApproveCorrectionActionConfig",
2906
+ description: "Configuration for approving a requested correction."
2907
+ }),
2908
+ RejectCorrectionConfig.meta({
2909
+ id: "RejectCorrectionActionConfig",
2910
+ description: "Configuration for rejecting a requested correction."
2911
+ }),
2780
2912
  EditActionConfig.meta({
2781
2913
  id: "EditActionConfig",
2782
2914
  description: "Configuration for editing a record before registration."
@@ -2785,6 +2917,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
2785
2917
  id: "ArchiveActionConfig",
2786
2918
  description: "Configuration for archiving a record."
2787
2919
  }),
2920
+ UnarchiveConfig.meta({
2921
+ id: "UnarchiveActionConfig",
2922
+ description: "Configuration for unarchiving a record."
2923
+ }),
2788
2924
  CustomActionConfig.meta({
2789
2925
  id: "CustomActionConfig",
2790
2926
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3193,7 +3329,7 @@ var getActionAnnotationFields = (actionConfig) => {
3193
3329
  if (actionConfig.type === ActionType.CUSTOM) {
3194
3330
  return actionConfig.form;
3195
3331
  }
3196
- if ("review" in actionConfig) {
3332
+ if ("review" in actionConfig && actionConfig.review != null) {
3197
3333
  return actionConfig.review.fields;
3198
3334
  }
3199
3335
  return [];
@@ -3904,7 +4040,7 @@ function validateActionFlags(event2, ctx) {
3904
4040
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3905
4041
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3906
4042
  const actionFlagIds = event2.actions.flatMap(
3907
- (action) => action.flags.map((flag) => flag.id)
4043
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3908
4044
  );
3909
4045
  for (const actionFlagId of actionFlagIds) {
3910
4046
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -4557,6 +4693,11 @@ var ArchiveActionInput = BaseActionInput.extend(
4557
4693
  content: ReasonContent
4558
4694
  }).shape
4559
4695
  );
4696
+ var UnarchiveActionInput = BaseActionInput.extend(
4697
+ z38.object({
4698
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4699
+ }).shape
4700
+ );
4560
4701
  var AssignActionInput = BaseActionInput.extend(
4561
4702
  z38.object({
4562
4703
  type: z38.literal(ActionType.ASSIGN),
@@ -4618,6 +4759,7 @@ var ActionInput = z38.discriminatedUnion("type", [
4618
4759
  id: "MarkNotDuplicateActionInput"
4619
4760
  }),
4620
4761
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4762
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
4621
4763
  AssignActionInput.meta({ id: "AssignActionInput" }),
4622
4764
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
4623
4765
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -4695,14 +4837,53 @@ var updateActions = ActionTypes.extract([
4695
4837
  ActionType.REGISTER,
4696
4838
  ActionType.REJECT,
4697
4839
  ActionType.ARCHIVE,
4840
+ ActionType.UNARCHIVE,
4698
4841
  ActionType.PRINT_CERTIFICATE,
4699
4842
  ActionType.REQUEST_CORRECTION,
4843
+ ActionType.APPROVE_CORRECTION,
4844
+ ActionType.REJECT_CORRECTION,
4700
4845
  ActionType.CUSTOM
4701
4846
  ]);
4702
4847
 
4703
4848
  // ../commons/src/events/state/flags.ts
4704
4849
  var import_lodash3 = require("lodash");
4705
4850
  var import_date_fns3 = require("date-fns");
4851
+ var INHERENT_FLAG_RULES = [
4852
+ {
4853
+ flag: InherentFlags.CORRECTION_REQUESTED,
4854
+ setOn: [ActionType.REQUEST_CORRECTION],
4855
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
4856
+ },
4857
+ {
4858
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4859
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
4860
+ // are deliberately excluded so the flag freezes across an archive/unarchive
4861
+ // round trip and comes back exactly as it was.
4862
+ flag: InherentFlags.INCOMPLETE,
4863
+ setOn: [ActionType.NOTIFY],
4864
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4865
+ },
4866
+ {
4867
+ flag: InherentFlags.REJECTED,
4868
+ setOn: [ActionType.REJECT],
4869
+ resetOn: [
4870
+ ActionType.NOTIFY,
4871
+ ActionType.DECLARE,
4872
+ ActionType.EDIT,
4873
+ ActionType.REGISTER
4874
+ ]
4875
+ },
4876
+ {
4877
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
4878
+ setOn: [ActionType.DUPLICATE_DETECTED],
4879
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
4880
+ },
4881
+ {
4882
+ flag: InherentFlags.EDIT_IN_PROGRESS,
4883
+ setOn: [ActionType.EDIT],
4884
+ resetOnAnyOtherAction: true
4885
+ }
4886
+ ];
4706
4887
 
4707
4888
  // ../commons/src/events/defineConfig.ts
4708
4889
  var IGNORED_EVENT_TYPES = [
@@ -5448,6 +5629,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5448
5629
  id: "signature.upload.modal.title",
5449
5630
  defaultMessage: "Draw signature",
5450
5631
  description: "Title for the modal to draw signature"
5632
+ },
5633
+ // Zod applies the schema default at parse time, but this fixture bypasses
5634
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
5635
+ configuration: {
5636
+ maxFileSize: 5 * 1024 * 1024
5451
5637
  }
5452
5638
  }
5453
5639
  ]
@@ -6004,6 +6190,20 @@ var tennisClubMembershipEvent = defineConfig({
6004
6190
  },
6005
6191
  review: TENNIS_CLUB_DECLARATION_REVIEW
6006
6192
  },
6193
+ {
6194
+ type: ActionType.NOTIFY,
6195
+ label: {
6196
+ defaultMessage: "Notify health worker",
6197
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6198
+ id: "event.tennis-club-membership.action.notify.label"
6199
+ },
6200
+ flags: [
6201
+ {
6202
+ id: "health-worker-notified",
6203
+ operation: "add"
6204
+ }
6205
+ ]
6206
+ },
6007
6207
  {
6008
6208
  type: ActionType.REJECT,
6009
6209
  label: {
@@ -6246,6 +6446,17 @@ var tennisClubMembershipEvent = defineConfig({
6246
6446
  }
6247
6447
  }
6248
6448
  ],
6449
+ flags: [
6450
+ {
6451
+ id: "health-worker-notified",
6452
+ requiresAction: false,
6453
+ label: {
6454
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6455
+ defaultMessage: "Health worker notified",
6456
+ description: "Label for the health-worker-notified flag"
6457
+ }
6458
+ }
6459
+ ],
6249
6460
  advancedSearch: [
6250
6461
  {
6251
6462
  title: {
@@ -7182,6 +7393,7 @@ var ACTION_SCOPE_MAP = {
7182
7393
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
7183
7394
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
7184
7395
  [ActionType.ARCHIVE]: ["record.archive"],
7396
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
7185
7397
  [ActionType.REJECT]: ["record.reject"],
7186
7398
  [ActionType.ASSIGN]: null,
7187
7399
  [ActionType.UNASSIGN]: null,
@@ -7224,7 +7436,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7224
7436
  ActionType.CUSTOM,
7225
7437
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
7226
7438
  ],
7227
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
7439
+ [EventStatus.enum.ARCHIVED]: [
7440
+ ActionType.READ,
7441
+ ActionType.CUSTOM,
7442
+ ActionType.UNARCHIVE
7443
+ ]
7228
7444
  };
7229
7445
  var ACTION_FILTERS = {
7230
7446
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
@@ -7237,10 +7453,18 @@ var ACTION_FILTERS = {
7237
7453
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7238
7454
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
7239
7455
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7456
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7240
7457
  [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7241
7458
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7242
7459
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7243
7460
  };
7461
+ var REJECTED_ACTIONS = [
7462
+ ActionType.READ,
7463
+ ActionType.NOTIFY,
7464
+ ActionType.CUSTOM,
7465
+ ActionType.EDIT,
7466
+ ActionType.ARCHIVE
7467
+ ];
7244
7468
 
7245
7469
  // ../commons/src/events/FileUtils.ts
7246
7470
  var import_lodash7 = require("lodash");