@opencrvs/toolkit 2.0.0 → 2.1.0-rc.0066f38

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 (106) hide show
  1. package/README.md +15 -0
  2. package/build.sh +5 -4
  3. package/create-countryconfig/package.json +1 -1
  4. package/dist/application-config/index.js +29 -6
  5. package/dist/cli.js +3186 -4921
  6. package/dist/commons/api/router.d.ts +623 -20
  7. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  8. package/dist/commons/events/ActionConfig.d.ts +237 -2
  9. package/dist/commons/events/ActionDocument.d.ts +44 -0
  10. package/dist/commons/events/ActionInput.d.ts +26 -0
  11. package/dist/commons/events/ActionType.d.ts +6 -1
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -0
  13. package/dist/commons/events/AuditLog.d.ts +2 -0
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
  15. package/dist/commons/events/Draft.d.ts +2 -0
  16. package/dist/commons/events/EventConfig.d.ts +2 -0
  17. package/dist/commons/events/EventDocument.d.ts +22 -0
  18. package/dist/commons/events/EventIndex.d.ts +25 -0
  19. package/dist/commons/events/EventMetadata.d.ts +26 -0
  20. package/dist/commons/events/FieldConfig.d.ts +15 -0
  21. package/dist/commons/events/WorkqueueConfig.d.ts +44 -2
  22. package/dist/commons/events/locations.d.ts +1 -0
  23. package/dist/commons/events/scopes.d.ts +1 -0
  24. package/dist/commons/events/state/index.d.ts +8 -0
  25. package/dist/commons/events/state/utils.d.ts +9 -0
  26. package/dist/commons/events/test.utils.d.ts +9 -1
  27. package/dist/commons/events/utils.d.ts +23 -1
  28. package/dist/conditionals/index.js +12 -5
  29. package/dist/environment/custom-types.d.ts +33 -0
  30. package/dist/environment/custom-types.d.ts.map +1 -0
  31. package/dist/environment/custom-types.js +12 -0
  32. package/dist/environment/derived-variables.d.ts +134 -0
  33. package/dist/environment/derived-variables.d.ts.map +1 -0
  34. package/dist/environment/derived-variables.js +169 -0
  35. package/dist/environment/editor-questions.d.ts +4 -0
  36. package/dist/environment/editor-questions.d.ts.map +1 -0
  37. package/dist/environment/editor-questions.js +67 -0
  38. package/dist/environment/git.d.ts +5 -0
  39. package/dist/environment/git.d.ts.map +1 -0
  40. package/dist/environment/git.js +38 -0
  41. package/dist/environment/github.d.ts +26 -0
  42. package/dist/environment/github.d.ts.map +1 -0
  43. package/dist/environment/github.js +247 -0
  44. package/dist/environment/index.d.ts +5 -0
  45. package/dist/environment/index.d.ts.map +1 -0
  46. package/dist/environment/index.js +71 -0
  47. package/dist/environment/logger.d.ts +15 -0
  48. package/dist/environment/logger.d.ts.map +1 -0
  49. package/dist/environment/logger.js +25 -0
  50. package/dist/environment/manage-users.d.ts +11 -0
  51. package/dist/environment/manage-users.d.ts.map +1 -0
  52. package/dist/environment/manage-users.js +497 -0
  53. package/dist/environment/questions-helper.d.ts +15 -0
  54. package/dist/environment/questions-helper.d.ts.map +1 -0
  55. package/dist/environment/questions-helper.js +70 -0
  56. package/dist/environment/questions.d.ts +199 -0
  57. package/dist/environment/questions.d.ts.map +1 -0
  58. package/dist/environment/questions.js +412 -0
  59. package/dist/environment/setup-environment.d.ts +2 -0
  60. package/dist/environment/setup-environment.d.ts.map +1 -0
  61. package/dist/environment/setup-environment.js +794 -0
  62. package/dist/environment/ssh-keygen.d.ts +5 -0
  63. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  64. package/dist/environment/ssh-keygen.js +21 -0
  65. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  66. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  67. package/dist/environment/swarm-to-k8s.js +173 -0
  68. package/dist/environment/templates.d.ts +27 -0
  69. package/dist/environment/templates.d.ts.map +1 -0
  70. package/dist/environment/templates.js +163 -0
  71. package/dist/environment/update-workflows.d.ts +2 -0
  72. package/dist/environment/update-workflows.d.ts.map +1 -0
  73. package/dist/environment/update-workflows.js +169 -0
  74. package/dist/environment/users.d.ts +2 -0
  75. package/dist/environment/users.d.ts.map +1 -0
  76. package/dist/environment/users.js +112 -0
  77. package/dist/environment/utils.d.ts +18 -0
  78. package/dist/environment/utils.d.ts.map +1 -0
  79. package/dist/environment/utils.js +100 -0
  80. package/dist/events/index.js +272 -39
  81. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  82. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  83. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  84. package/dist/migrations/v2.0/index.js +88 -5139
  85. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  86. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  87. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  88. package/dist/migrations/v2.1/index.d.ts +6 -0
  89. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  90. package/dist/migrations/v2.1/index.js +218 -0
  91. package/dist/notification/index.js +197 -28
  92. package/dist/scopes/index.d.ts +96 -2
  93. package/dist/scopes/index.js +12 -5
  94. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  95. package/dist/templates/charts-values/dependencies/values.yaml +83 -0
  96. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  97. package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
  98. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  99. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  100. package/dist/templates/inventory/inventory.template.yml +100 -0
  101. package/dist/templates/inventory/production.example.yml +77 -0
  102. package/dist/templates/inventory/qa.example.yml +48 -0
  103. package/opencrvs-toolkit-2.1.0-rc.0066f38.tgz +0 -0
  104. package/package.json +15 -1
  105. package/tsconfig.tsbuildinfo +1 -1
  106. package/opencrvs-toolkit-2.0.0.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",
@@ -1186,6 +1198,11 @@ var ArchiveAction = ActionBase.extend(
1186
1198
  content: ReasonContent
1187
1199
  }).shape
1188
1200
  );
1201
+ var UnarchiveAction = ActionBase.extend(
1202
+ z14.object({
1203
+ type: z14.literal(ActionType.UNARCHIVE)
1204
+ }).shape
1205
+ );
1189
1206
  var CreatedAction = ActionBase.extend(
1190
1207
  z14.object({
1191
1208
  type: z14.literal(ActionType.CREATE)
@@ -1252,6 +1269,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1252
1269
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1253
1270
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1254
1271
  ArchiveAction.meta({ id: "ArchiveAction" }),
1272
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1255
1273
  NotifiedAction.meta({ id: "NotifiedAction" }),
1256
1274
  RegisterAction.meta({ id: "RegisterAction" }),
1257
1275
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1357,6 +1375,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1357
1375
  )
1358
1376
  });
1359
1377
  var LegalStatuses = z16.object({
1378
+ [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1360
1379
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1361
1380
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1362
1381
  });
@@ -1416,6 +1435,8 @@ var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
1416
1435
  var EventMetadataDateFieldIdInput = z16.enum([
1417
1436
  "createdAt",
1418
1437
  "updatedAt",
1438
+ "legalStatuses.NOTIFIED.createdAt",
1439
+ "legalStatuses.NOTIFIED.acceptedAt",
1419
1440
  "legalStatuses.DECLARED.createdAt",
1420
1441
  "legalStatuses.DECLARED.acceptedAt",
1421
1442
  "legalStatuses.REGISTERED.createdAt",
@@ -1424,6 +1445,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
1424
1445
  var EventMetadataDateFieldId = z16.enum([
1425
1446
  "event.createdAt",
1426
1447
  "event.updatedAt",
1448
+ "event.legalStatuses.NOTIFIED.createdAt",
1449
+ "event.legalStatuses.NOTIFIED.acceptedAt",
1427
1450
  "event.legalStatuses.DECLARED.createdAt",
1428
1451
  "event.legalStatuses.DECLARED.acceptedAt",
1429
1452
  "event.legalStatuses.REGISTERED.createdAt",
@@ -1483,7 +1506,8 @@ var Range = import_v4.z.object({
1483
1506
  });
1484
1507
  var ContainsFlags = import_v4.z.object({
1485
1508
  anyOf: import_v4.z.array(Flag).optional(),
1486
- noneOf: import_v4.z.array(Flag).optional()
1509
+ noneOf: import_v4.z.array(Flag).optional(),
1510
+ allOf: import_v4.z.array(Flag).optional()
1487
1511
  }).meta({
1488
1512
  id: "ContainsFlags"
1489
1513
  });
@@ -2670,6 +2694,9 @@ var ActionConfigBase = z24.object({
2670
2694
  var DeclarationActionBase = ActionConfigBase.extend({
2671
2695
  deduplication: DeduplicationConfig.optional()
2672
2696
  });
2697
+ var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
2698
+ "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
2699
+ );
2673
2700
  var ReadActionConfig = ActionConfigBase.extend(
2674
2701
  z24.object({
2675
2702
  type: z24.literal(ActionType.READ),
@@ -2679,12 +2706,65 @@ var ReadActionConfig = ActionConfigBase.extend(
2679
2706
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2680
2707
  }).shape
2681
2708
  );
2709
+ var NotifyConfig = ActionConfigBase.extend(
2710
+ z24.object({
2711
+ type: z24.literal(ActionType.NOTIFY),
2712
+ form: actionConfirmationForm
2713
+ }).shape
2714
+ );
2715
+ var DuplicateDetectedConfig = ActionConfigBase.extend(
2716
+ z24.object({
2717
+ type: z24.literal(ActionType.DUPLICATE_DETECTED),
2718
+ label: z24.never().optional().describe(
2719
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
2720
+ ),
2721
+ supportingCopy: z24.never().optional(),
2722
+ icon: z24.never().optional().describe(
2723
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
2724
+ ),
2725
+ conditionals: z24.never().optional().describe(
2726
+ "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
2727
+ )
2728
+ }).shape
2729
+ );
2730
+ var MarkAsDuplicateConfig = ActionConfigBase.extend(
2731
+ z24.object({
2732
+ type: z24.literal(ActionType.MARK_AS_DUPLICATE)
2733
+ }).shape
2734
+ );
2735
+ var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
2736
+ z24.object({
2737
+ type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
2738
+ }).shape
2739
+ );
2740
+ var AssignConfig = ActionConfigBase.extend(
2741
+ z24.object({
2742
+ type: z24.literal(ActionType.ASSIGN),
2743
+ flags: z24.never().optional().describe(
2744
+ "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2745
+ )
2746
+ }).shape
2747
+ );
2748
+ var UnassignConfig = ActionConfigBase.extend(
2749
+ z24.object({
2750
+ type: z24.literal(ActionType.UNASSIGN),
2751
+ flags: z24.never().optional().describe(
2752
+ "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
2753
+ )
2754
+ }).shape
2755
+ );
2756
+ var DeleteConfig = ActionConfigBase.extend(
2757
+ z24.object({
2758
+ type: z24.literal(ActionType.DELETE)
2759
+ }).shape
2760
+ );
2682
2761
  var DeclareConfig = DeclarationActionBase.extend(
2683
2762
  z24.object({
2684
2763
  type: z24.literal(ActionType.DECLARE),
2685
2764
  review: DeclarationReviewConfig.describe(
2686
2765
  "Configuration of the review page fields."
2687
2766
  ),
2767
+ form: actionConfirmationForm,
2688
2768
  dialogCopy: z24.object({
2689
2769
  notify: TranslationConfig.describe(
2690
2770
  "Confirmation text for the notify action"
@@ -2700,7 +2780,13 @@ var DeclareConfig = DeclarationActionBase.extend(
2700
2780
  );
2701
2781
  var ArchiveConfig = ActionConfigBase.extend(
2702
2782
  z24.object({
2703
- type: z24.literal(ActionType.ARCHIVE)
2783
+ type: z24.literal(ActionType.ARCHIVE),
2784
+ form: actionConfirmationForm
2785
+ }).shape
2786
+ );
2787
+ var UnarchiveConfig = ActionConfigBase.extend(
2788
+ z24.object({
2789
+ type: z24.literal(ActionType.UNARCHIVE)
2704
2790
  }).shape
2705
2791
  );
2706
2792
  var EditActionConfig = ActionConfigBase.extend(
@@ -2721,12 +2807,14 @@ var EditActionConfig = ActionConfigBase.extend(
2721
2807
  );
2722
2808
  var RejectConfig = ActionConfigBase.extend(
2723
2809
  z24.object({
2724
- type: z24.literal(ActionType.REJECT)
2810
+ type: z24.literal(ActionType.REJECT),
2811
+ form: actionConfirmationForm
2725
2812
  }).shape
2726
2813
  );
2727
2814
  var RegisterConfig = DeclarationActionBase.extend(
2728
2815
  z24.object({
2729
- type: z24.literal(ActionType.REGISTER)
2816
+ type: z24.literal(ActionType.REGISTER),
2817
+ form: actionConfirmationForm
2730
2818
  }).shape
2731
2819
  );
2732
2820
  var PrintCertificateActionConfig = ActionConfigBase.extend(
@@ -2741,7 +2829,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2741
2829
  correctionForm: ActionFormConfig
2742
2830
  }).shape
2743
2831
  );
2744
- var CustomActionConfig = ActionConfigBase.merge(
2832
+ var ApproveCorrectionConfig = ActionConfigBase.extend(
2833
+ z24.object({
2834
+ type: z24.literal(ActionType.APPROVE_CORRECTION)
2835
+ }).shape
2836
+ );
2837
+ var RejectCorrectionConfig = ActionConfigBase.extend(
2838
+ z24.object({
2839
+ type: z24.literal(ActionType.REJECT_CORRECTION)
2840
+ }).shape
2841
+ );
2842
+ var CustomActionConfig = ActionConfigBase.extend(
2745
2843
  z24.object({
2746
2844
  type: z24.literal(ActionType.CUSTOM),
2747
2845
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2752,7 +2850,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2752
2850
  auditHistoryLabel: TranslationConfig.describe(
2753
2851
  'The label to show in audit history for this action. For example "Approved".'
2754
2852
  )
2755
- })
2853
+ }).shape
2756
2854
  );
2757
2855
  var ActionConfig = z24.discriminatedUnion("type", [
2758
2856
  /*
@@ -2763,9 +2861,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
2763
2861
  id: "ReadActionConfig",
2764
2862
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2765
2863
  }),
2864
+ AssignConfig.meta({
2865
+ id: "AssignActionConfig",
2866
+ description: "Configuration for assigning a record to the current user."
2867
+ }),
2868
+ UnassignConfig.meta({
2869
+ id: "UnassignActionConfig",
2870
+ description: "Configuration for unassigning a record from its current assignee."
2871
+ }),
2872
+ DeleteConfig.meta({
2873
+ id: "DeleteActionConfig",
2874
+ description: "Configuration for deleting a draft record."
2875
+ }),
2876
+ NotifyConfig.meta({
2877
+ id: "NotifyActionConfig",
2878
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
2879
+ }),
2766
2880
  DeclareConfig.meta({
2767
2881
  id: "DeclareActionConfig",
2768
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2882
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
2883
+ }),
2884
+ DuplicateDetectedConfig.meta({
2885
+ id: "DuplicateDetectedActionConfig",
2886
+ 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."
2887
+ }),
2888
+ MarkAsDuplicateConfig.meta({
2889
+ id: "MarkAsDuplicateActionConfig",
2890
+ description: "Configuration for marking a record as a duplicate."
2891
+ }),
2892
+ MarkAsNotDuplicateConfig.meta({
2893
+ id: "MarkAsNotDuplicateActionConfig",
2894
+ description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
2769
2895
  }),
2770
2896
  RejectConfig.meta({
2771
2897
  id: "RejectActionConfig",
@@ -2783,6 +2909,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2783
2909
  id: "RequestCorrectionActionConfig",
2784
2910
  description: "Configuration for requesting a correction on a registered record."
2785
2911
  }),
2912
+ ApproveCorrectionConfig.meta({
2913
+ id: "ApproveCorrectionActionConfig",
2914
+ description: "Configuration for approving a requested correction."
2915
+ }),
2916
+ RejectCorrectionConfig.meta({
2917
+ id: "RejectCorrectionActionConfig",
2918
+ description: "Configuration for rejecting a requested correction."
2919
+ }),
2786
2920
  EditActionConfig.meta({
2787
2921
  id: "EditActionConfig",
2788
2922
  description: "Configuration for editing a record before registration."
@@ -2791,6 +2925,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
2791
2925
  id: "ArchiveActionConfig",
2792
2926
  description: "Configuration for archiving a record."
2793
2927
  }),
2928
+ UnarchiveConfig.meta({
2929
+ id: "UnarchiveActionConfig",
2930
+ description: "Configuration for unarchiving a record."
2931
+ }),
2794
2932
  CustomActionConfig.meta({
2795
2933
  id: "CustomActionConfig",
2796
2934
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3196,13 +3334,9 @@ var getActionAnnotationFields = (actionConfig) => {
3196
3334
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3197
3335
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3198
3336
  }
3199
- if (actionConfig.type === ActionType.CUSTOM) {
3200
- return actionConfig.form;
3201
- }
3202
- if ("review" in actionConfig) {
3203
- return actionConfig.review.fields;
3204
- }
3205
- return [];
3337
+ const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
3338
+ const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
3339
+ return [...reviewFields, ...formFields];
3206
3340
  };
3207
3341
  function getAllAnnotationFields(config) {
3208
3342
  return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
@@ -3910,7 +4044,7 @@ function validateActionFlags(event2, ctx) {
3910
4044
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3911
4045
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3912
4046
  const actionFlagIds = event2.actions.flatMap(
3913
- (action) => action.flags.map((flag) => flag.id)
4047
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3914
4048
  );
3915
4049
  for (const actionFlagId of actionFlagIds) {
3916
4050
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -4563,6 +4697,11 @@ var ArchiveActionInput = BaseActionInput.extend(
4563
4697
  content: ReasonContent
4564
4698
  }).shape
4565
4699
  );
4700
+ var UnarchiveActionInput = BaseActionInput.extend(
4701
+ z38.object({
4702
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4703
+ }).shape
4704
+ );
4566
4705
  var AssignActionInput = BaseActionInput.extend(
4567
4706
  z38.object({
4568
4707
  type: z38.literal(ActionType.ASSIGN),
@@ -4624,6 +4763,7 @@ var ActionInput = z38.discriminatedUnion("type", [
4624
4763
  id: "MarkNotDuplicateActionInput"
4625
4764
  }),
4626
4765
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4766
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
4627
4767
  AssignActionInput.meta({ id: "AssignActionInput" }),
4628
4768
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
4629
4769
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -4701,6 +4841,7 @@ var updateActions = ActionTypes.extract([
4701
4841
  ActionType.REGISTER,
4702
4842
  ActionType.REJECT,
4703
4843
  ActionType.ARCHIVE,
4844
+ ActionType.UNARCHIVE,
4704
4845
  ActionType.PRINT_CERTIFICATE,
4705
4846
  ActionType.REQUEST_CORRECTION,
4706
4847
  ActionType.APPROVE_CORRECTION,
@@ -4719,15 +4860,12 @@ var INHERENT_FLAG_RULES = [
4719
4860
  },
4720
4861
  {
4721
4862
  // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4722
- // other status-changing action (see getStatusFromActions).
4863
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
4864
+ // are deliberately excluded so the flag freezes across an archive/unarchive
4865
+ // round trip and comes back exactly as it was.
4723
4866
  flag: InherentFlags.INCOMPLETE,
4724
4867
  setOn: [ActionType.NOTIFY],
4725
- resetOn: [
4726
- ActionType.CREATE,
4727
- ActionType.DECLARE,
4728
- ActionType.REGISTER,
4729
- ActionType.ARCHIVE
4730
- ]
4868
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4731
4869
  },
4732
4870
  {
4733
4871
  flag: InherentFlags.REJECTED,
@@ -6056,6 +6194,20 @@ var tennisClubMembershipEvent = defineConfig({
6056
6194
  },
6057
6195
  review: TENNIS_CLUB_DECLARATION_REVIEW
6058
6196
  },
6197
+ {
6198
+ type: ActionType.NOTIFY,
6199
+ label: {
6200
+ defaultMessage: "Notify health worker",
6201
+ description: "This is shown as the action name anywhere the user can trigger the action from",
6202
+ id: "event.tennis-club-membership.action.notify.label"
6203
+ },
6204
+ flags: [
6205
+ {
6206
+ id: "health-worker-notified",
6207
+ operation: "add"
6208
+ }
6209
+ ]
6210
+ },
6059
6211
  {
6060
6212
  type: ActionType.REJECT,
6061
6213
  label: {
@@ -6298,6 +6450,17 @@ var tennisClubMembershipEvent = defineConfig({
6298
6450
  }
6299
6451
  }
6300
6452
  ],
6453
+ flags: [
6454
+ {
6455
+ id: "health-worker-notified",
6456
+ requiresAction: false,
6457
+ label: {
6458
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
6459
+ defaultMessage: "Health worker notified",
6460
+ description: "Label for the health-worker-notified flag"
6461
+ }
6462
+ }
6463
+ ],
6301
6464
  advancedSearch: [
6302
6465
  {
6303
6466
  title: {
@@ -7234,6 +7397,7 @@ var ACTION_SCOPE_MAP = {
7234
7397
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
7235
7398
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
7236
7399
  [ActionType.ARCHIVE]: ["record.archive"],
7400
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
7237
7401
  [ActionType.REJECT]: ["record.reject"],
7238
7402
  [ActionType.ASSIGN]: null,
7239
7403
  [ActionType.UNASSIGN]: null,
@@ -7276,7 +7440,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7276
7440
  ActionType.CUSTOM,
7277
7441
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
7278
7442
  ],
7279
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
7443
+ [EventStatus.enum.ARCHIVED]: [
7444
+ ActionType.READ,
7445
+ ActionType.CUSTOM,
7446
+ ActionType.UNARCHIVE
7447
+ ]
7280
7448
  };
7281
7449
  var ACTION_FILTERS = {
7282
7450
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
@@ -7289,6 +7457,7 @@ var ACTION_FILTERS = {
7289
7457
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7290
7458
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
7291
7459
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7460
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7292
7461
  [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7293
7462
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7294
7463
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))