@opencrvs/toolkit 2.0.0 → 2.1.0-rc.05eb1de

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 (109) 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 +729 -126
  7. package/dist/commons/conditionals/conditionals.d.ts +1592 -40
  8. package/dist/commons/events/ActionConfig.d.ts +230 -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/field.d.ts +722 -34
  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 +6 -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 +507 -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 +183 -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 +179 -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 +122 -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 +110 -0
  81. package/dist/events/index.js +245 -29
  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/convert-config-files-to-ts.js +17 -7
  86. package/dist/migrations/v2.0/index.js +88 -5139
  87. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  88. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  89. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  90. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  91. package/dist/migrations/v2.1/index.d.ts +6 -0
  92. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  93. package/dist/migrations/v2.1/index.js +218 -0
  94. package/dist/notification/index.js +184 -19
  95. package/dist/scopes/index.d.ts +96 -2
  96. package/dist/scopes/index.js +12 -5
  97. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  98. package/dist/templates/charts-values/dependencies/values.yaml +83 -0
  99. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  100. package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
  101. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  102. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  103. package/dist/templates/inventory/inventory.template.yml +100 -0
  104. package/dist/templates/inventory/production.example.yml +77 -0
  105. package/dist/templates/inventory/qa.example.yml +48 -0
  106. package/opencrvs-toolkit-2.1.0-rc.05eb1de.tgz +0 -0
  107. package/package.json +16 -2
  108. package/tsconfig.tsbuildinfo +1 -1
  109. 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
  });
@@ -2679,6 +2703,57 @@ var ReadActionConfig = ActionConfigBase.extend(
2679
2703
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2680
2704
  }).shape
2681
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
+ );
2682
2757
  var DeclareConfig = DeclarationActionBase.extend(
2683
2758
  z24.object({
2684
2759
  type: z24.literal(ActionType.DECLARE),
@@ -2703,6 +2778,11 @@ var ArchiveConfig = ActionConfigBase.extend(
2703
2778
  type: z24.literal(ActionType.ARCHIVE)
2704
2779
  }).shape
2705
2780
  );
2781
+ var UnarchiveConfig = ActionConfigBase.extend(
2782
+ z24.object({
2783
+ type: z24.literal(ActionType.UNARCHIVE)
2784
+ }).shape
2785
+ );
2706
2786
  var EditActionConfig = ActionConfigBase.extend(
2707
2787
  z24.object({
2708
2788
  type: z24.literal(ActionType.EDIT),
@@ -2741,7 +2821,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
2741
2821
  correctionForm: ActionFormConfig
2742
2822
  }).shape
2743
2823
  );
2744
- 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(
2745
2835
  z24.object({
2746
2836
  type: z24.literal(ActionType.CUSTOM),
2747
2837
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -2752,7 +2842,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2752
2842
  auditHistoryLabel: TranslationConfig.describe(
2753
2843
  'The label to show in audit history for this action. For example "Approved".'
2754
2844
  )
2755
- })
2845
+ }).shape
2756
2846
  );
2757
2847
  var ActionConfig = z24.discriminatedUnion("type", [
2758
2848
  /*
@@ -2763,9 +2853,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
2763
2853
  id: "ReadActionConfig",
2764
2854
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2765
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
+ }),
2766
2872
  DeclareConfig.meta({
2767
2873
  id: "DeclareActionConfig",
2768
- 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."
2769
2887
  }),
2770
2888
  RejectConfig.meta({
2771
2889
  id: "RejectActionConfig",
@@ -2783,6 +2901,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
2783
2901
  id: "RequestCorrectionActionConfig",
2784
2902
  description: "Configuration for requesting a correction on a registered record."
2785
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
+ }),
2786
2912
  EditActionConfig.meta({
2787
2913
  id: "EditActionConfig",
2788
2914
  description: "Configuration for editing a record before registration."
@@ -2791,6 +2917,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
2791
2917
  id: "ArchiveActionConfig",
2792
2918
  description: "Configuration for archiving a record."
2793
2919
  }),
2920
+ UnarchiveConfig.meta({
2921
+ id: "UnarchiveActionConfig",
2922
+ description: "Configuration for unarchiving a record."
2923
+ }),
2794
2924
  CustomActionConfig.meta({
2795
2925
  id: "CustomActionConfig",
2796
2926
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3199,7 +3329,7 @@ var getActionAnnotationFields = (actionConfig) => {
3199
3329
  if (actionConfig.type === ActionType.CUSTOM) {
3200
3330
  return actionConfig.form;
3201
3331
  }
3202
- if ("review" in actionConfig) {
3332
+ if ("review" in actionConfig && actionConfig.review != null) {
3203
3333
  return actionConfig.review.fields;
3204
3334
  }
3205
3335
  return [];
@@ -3910,7 +4040,7 @@ function validateActionFlags(event2, ctx) {
3910
4040
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
3911
4041
  const configuredFlagIds = event2.flags.map((flag) => flag.id);
3912
4042
  const actionFlagIds = event2.actions.flatMap(
3913
- (action) => action.flags.map((flag) => flag.id)
4043
+ (action) => (action.flags ?? []).map((flag) => flag.id)
3914
4044
  );
3915
4045
  for (const actionFlagId of actionFlagIds) {
3916
4046
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -4563,6 +4693,11 @@ var ArchiveActionInput = BaseActionInput.extend(
4563
4693
  content: ReasonContent
4564
4694
  }).shape
4565
4695
  );
4696
+ var UnarchiveActionInput = BaseActionInput.extend(
4697
+ z38.object({
4698
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
4699
+ }).shape
4700
+ );
4566
4701
  var AssignActionInput = BaseActionInput.extend(
4567
4702
  z38.object({
4568
4703
  type: z38.literal(ActionType.ASSIGN),
@@ -4624,6 +4759,7 @@ var ActionInput = z38.discriminatedUnion("type", [
4624
4759
  id: "MarkNotDuplicateActionInput"
4625
4760
  }),
4626
4761
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4762
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
4627
4763
  AssignActionInput.meta({ id: "AssignActionInput" }),
4628
4764
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
4629
4765
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -4701,6 +4837,7 @@ var updateActions = ActionTypes.extract([
4701
4837
  ActionType.REGISTER,
4702
4838
  ActionType.REJECT,
4703
4839
  ActionType.ARCHIVE,
4840
+ ActionType.UNARCHIVE,
4704
4841
  ActionType.PRINT_CERTIFICATE,
4705
4842
  ActionType.REQUEST_CORRECTION,
4706
4843
  ActionType.APPROVE_CORRECTION,
@@ -4719,15 +4856,12 @@ var INHERENT_FLAG_RULES = [
4719
4856
  },
4720
4857
  {
4721
4858
  // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
4722
- // other status-changing action (see getStatusFromActions).
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.
4723
4862
  flag: InherentFlags.INCOMPLETE,
4724
4863
  setOn: [ActionType.NOTIFY],
4725
- resetOn: [
4726
- ActionType.CREATE,
4727
- ActionType.DECLARE,
4728
- ActionType.REGISTER,
4729
- ActionType.ARCHIVE
4730
- ]
4864
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
4731
4865
  },
4732
4866
  {
4733
4867
  flag: InherentFlags.REJECTED,
@@ -6056,6 +6190,20 @@ var tennisClubMembershipEvent = defineConfig({
6056
6190
  },
6057
6191
  review: TENNIS_CLUB_DECLARATION_REVIEW
6058
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
+ },
6059
6207
  {
6060
6208
  type: ActionType.REJECT,
6061
6209
  label: {
@@ -6298,6 +6446,17 @@ var tennisClubMembershipEvent = defineConfig({
6298
6446
  }
6299
6447
  }
6300
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
+ ],
6301
6460
  advancedSearch: [
6302
6461
  {
6303
6462
  title: {
@@ -7234,6 +7393,7 @@ var ACTION_SCOPE_MAP = {
7234
7393
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
7235
7394
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
7236
7395
  [ActionType.ARCHIVE]: ["record.archive"],
7396
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
7237
7397
  [ActionType.REJECT]: ["record.reject"],
7238
7398
  [ActionType.ASSIGN]: null,
7239
7399
  [ActionType.UNASSIGN]: null,
@@ -7276,7 +7436,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7276
7436
  ActionType.CUSTOM,
7277
7437
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
7278
7438
  ],
7279
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
7439
+ [EventStatus.enum.ARCHIVED]: [
7440
+ ActionType.READ,
7441
+ ActionType.CUSTOM,
7442
+ ActionType.UNARCHIVE
7443
+ ]
7280
7444
  };
7281
7445
  var ACTION_FILTERS = {
7282
7446
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
@@ -7289,6 +7453,7 @@ var ACTION_FILTERS = {
7289
7453
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
7290
7454
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
7291
7455
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7456
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7292
7457
  [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7293
7458
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7294
7459
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))