@opencrvs/toolkit 2.0.0-rc.9394765 → 2.0.0-rc.93c6ac0

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 (101) hide show
  1. package/README.md +15 -0
  2. package/build.sh +3 -2
  3. package/dist/application-config/index.js +35 -6
  4. package/dist/cli.js +3255 -47
  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 +54 -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 +259 -71
  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 +13 -6
  86. package/dist/notification/index.js +145 -9
  87. package/dist/scopes/index.d.ts +96 -2
  88. package/dist/scopes/index.js +12 -5
  89. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  90. package/dist/templates/charts-values/dependencies/values.yaml +83 -0
  91. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  92. package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
  93. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  94. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  95. package/dist/templates/inventory/inventory.template.yml +100 -0
  96. package/dist/templates/inventory/production.example.yml +77 -0
  97. package/dist/templates/inventory/qa.example.yml +48 -0
  98. package/opencrvs-toolkit-2.0.0-rc.93c6ac0.tgz +0 -0
  99. package/package.json +15 -1
  100. package/tsconfig.tsbuildinfo +1 -1
  101. package/opencrvs-toolkit-2.0.0-rc.9394765.tgz +0 -0
@@ -151,6 +151,7 @@ __export(events_exports, {
151
151
  FormPageConfig: () => FormPageConfig,
152
152
  Fuzzy: () => Fuzzy,
153
153
  GeographicalArea: () => GeographicalArea,
154
+ HiddenFieldTypes: () => HiddenFieldTypes,
154
155
  HiddenFieldValue: () => HiddenFieldValue,
155
156
  HttpFieldUpdateValue: () => HttpFieldUpdateValue,
156
157
  HttpFieldValue: () => HttpFieldValue,
@@ -213,6 +214,7 @@ __export(events_exports, {
213
214
  TimeValue: () => TimeValue,
214
215
  TranslationConfig: () => TranslationConfig,
215
216
  UUID: () => UUID,
217
+ UnarchiveActionInput: () => UnarchiveActionInput,
216
218
  UnassignActionInput: () => UnassignActionInput,
217
219
  UserAuditRecordInput: () => UserAuditRecordInput,
218
220
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
@@ -480,6 +482,7 @@ var RecordScopeTypeV2 = z2.enum([
480
482
  "record.edit",
481
483
  "record.reject",
482
484
  "record.archive",
485
+ "record.unarchive",
483
486
  "record.review-duplicates",
484
487
  "record.register",
485
488
  "record.print-certified-copies",
@@ -519,11 +522,13 @@ var scopeOptionsPlaceEvent = z2.object({
519
522
  event: scopeByEvent,
520
523
  placeOfEvent: JurisdictionFilter.optional()
521
524
  }).describe("Options applicable to all record scopes.");
522
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
525
+ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
526
+ notifiedIn: JurisdictionFilter.optional(),
527
+ notifiedBy: UserFilter.optional(),
523
528
  declaredIn: JurisdictionFilter.optional(),
524
529
  declaredBy: UserFilter.optional()
525
530
  }).describe("Options applicable to actions that may take place after DECLARE");
526
- var AllRecordScopeOptions = scopeOptionsDeclared.extend({
531
+ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
527
532
  registeredIn: JurisdictionFilter.optional(),
528
533
  registeredBy: UserFilter.optional()
529
534
  }).describe(
@@ -561,6 +566,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
561
566
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
562
567
  );
563
568
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
569
+ notifiedIn: UUID.nullish(),
570
+ notifiedBy: z2.string().optional(),
564
571
  declaredIn: UUID.nullish(),
565
572
  declaredBy: z2.string().optional()
566
573
  }).describe(
@@ -581,6 +588,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
581
588
  "record.edit",
582
589
  "record.reject",
583
590
  "record.archive",
591
+ "record.unarchive",
584
592
  "record.review-duplicates",
585
593
  "record.register"
586
594
  ]);
@@ -606,7 +614,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
606
614
  }),
607
615
  z2.object({
608
616
  type: ScopesWithDeclaredOptions,
609
- options: scopeOptionsDeclared.optional()
617
+ options: scopeOptionsDeclaredOrNotified.optional()
610
618
  }),
611
619
  z2.object({
612
620
  type: ScopesWithFullOptions,
@@ -729,8 +737,9 @@ var decodeScope = (encodedScope) => {
729
737
  var DEFAULT_SCOPE_OPTIONS = {
730
738
  placeOfEvent: JurisdictionFilter.enum.all,
731
739
  accessLevel: JurisdictionFilter.enum.all,
732
- registeredIn: JurisdictionFilter.enum.all,
733
- declaredIn: JurisdictionFilter.enum.all
740
+ notifiedIn: JurisdictionFilter.enum.all,
741
+ declaredIn: JurisdictionFilter.enum.all,
742
+ registeredIn: JurisdictionFilter.enum.all
734
743
  };
735
744
  function getAcceptedScopesByType({
736
745
  acceptedScopes,
@@ -766,6 +775,7 @@ var ActionType = {
766
775
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
767
776
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
768
777
  ARCHIVE: "ARCHIVE",
778
+ UNARCHIVE: "UNARCHIVE",
769
779
  // Record actions
770
780
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
771
781
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -785,6 +795,7 @@ var ConfirmableActions = [
785
795
  ActionType.REGISTER,
786
796
  ActionType.REJECT,
787
797
  ActionType.ARCHIVE,
798
+ ActionType.UNARCHIVE,
788
799
  ActionType.PRINT_CERTIFICATE,
789
800
  ActionType.REQUEST_CORRECTION,
790
801
  ActionType.APPROVE_CORRECTION,
@@ -803,6 +814,7 @@ var ActionTypes = z4.enum([
803
814
  "MARK_AS_DUPLICATE",
804
815
  "MARK_AS_NOT_DUPLICATE",
805
816
  "ARCHIVE",
817
+ "UNARCHIVE",
806
818
  "PRINT_CERTIFICATE",
807
819
  "REQUEST_CORRECTION",
808
820
  "REJECT_CORRECTION",
@@ -846,6 +858,7 @@ var WorkqueueActionType = ActionTypes.extract([
846
858
  ActionType.REJECT,
847
859
  ActionType.MARK_AS_DUPLICATE,
848
860
  ActionType.ARCHIVE,
861
+ ActionType.UNARCHIVE,
849
862
  ActionType.PRINT_CERTIFICATE,
850
863
  ActionType.REQUEST_CORRECTION
851
864
  ]);
@@ -910,6 +923,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
910
923
  "event.actions.unassign.request",
911
924
  "event.actions.read.request",
912
925
  "event.actions.archive.request",
926
+ "event.actions.unarchive.request",
913
927
  "event.actions.reinstate.request",
914
928
  "event.actions.print_certificate.request",
915
929
  "event.actions.correction.request.request",
@@ -1219,6 +1233,11 @@ var FieldTypesToHideInReview = [
1219
1233
  FieldType.ALPHA_PRINT_BUTTON,
1220
1234
  FieldType.ALPHA_HIDDEN
1221
1235
  ];
1236
+ var HiddenFieldTypes = [
1237
+ FieldType.HTTP,
1238
+ FieldType.QUERY_PARAM_READER,
1239
+ FieldType.ALPHA_HIDDEN
1240
+ ];
1222
1241
 
1223
1242
  // ../commons/src/events/FieldValue.ts
1224
1243
  var z12 = __toESM(require("zod/v4"));
@@ -1638,6 +1657,11 @@ var ArchiveAction = ActionBase.extend(
1638
1657
  content: ReasonContent
1639
1658
  }).shape
1640
1659
  );
1660
+ var UnarchiveAction = ActionBase.extend(
1661
+ z14.object({
1662
+ type: z14.literal(ActionType.UNARCHIVE)
1663
+ }).shape
1664
+ );
1641
1665
  var CreatedAction = ActionBase.extend(
1642
1666
  z14.object({
1643
1667
  type: z14.literal(ActionType.CREATE)
@@ -1704,6 +1728,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1704
1728
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1705
1729
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1706
1730
  ArchiveAction.meta({ id: "ArchiveAction" }),
1731
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1707
1732
  NotifiedAction.meta({ id: "NotifiedAction" }),
1708
1733
  RegisterAction.meta({ id: "RegisterAction" }),
1709
1734
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1809,6 +1834,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1809
1834
  )
1810
1835
  });
1811
1836
  var LegalStatuses = z16.object({
1837
+ [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1812
1838
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1813
1839
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1814
1840
  });
@@ -1950,6 +1976,8 @@ var eventMetadataLabelMap = {
1950
1976
  var EventMetadataDateFieldIdInput = z16.enum([
1951
1977
  "createdAt",
1952
1978
  "updatedAt",
1979
+ "legalStatuses.NOTIFIED.createdAt",
1980
+ "legalStatuses.NOTIFIED.acceptedAt",
1953
1981
  "legalStatuses.DECLARED.createdAt",
1954
1982
  "legalStatuses.DECLARED.acceptedAt",
1955
1983
  "legalStatuses.REGISTERED.createdAt",
@@ -1958,6 +1986,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
1958
1986
  var EventMetadataDateFieldId = z16.enum([
1959
1987
  "event.createdAt",
1960
1988
  "event.updatedAt",
1989
+ "event.legalStatuses.NOTIFIED.createdAt",
1990
+ "event.legalStatuses.NOTIFIED.acceptedAt",
1961
1991
  "event.legalStatuses.DECLARED.createdAt",
1962
1992
  "event.legalStatuses.DECLARED.acceptedAt",
1963
1993
  "event.legalStatuses.REGISTERED.createdAt",
@@ -2017,7 +2047,8 @@ var Range = import_v4.z.object({
2017
2047
  });
2018
2048
  var ContainsFlags = import_v4.z.object({
2019
2049
  anyOf: import_v4.z.array(Flag).optional(),
2020
- noneOf: import_v4.z.array(Flag).optional()
2050
+ noneOf: import_v4.z.array(Flag).optional(),
2051
+ allOf: import_v4.z.array(Flag).optional()
2021
2052
  }).meta({
2022
2053
  id: "ContainsFlags"
2023
2054
  });
@@ -2292,6 +2323,7 @@ var NumberField = BaseField.extend({
2292
2323
  configuration: import_v43.default.object({
2293
2324
  min: import_v43.default.number().optional().describe("Minimum value"),
2294
2325
  max: import_v43.default.number().optional().describe("Maximum value"),
2326
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
2295
2327
  prefix: TranslationConfig.optional(),
2296
2328
  postfix: TranslationConfig.optional()
2297
2329
  }).optional()
@@ -3215,6 +3247,11 @@ var ReadActionConfig = ActionConfigBase.extend(
3215
3247
  conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
3216
3248
  }).shape
3217
3249
  );
3250
+ var NotifyConfig = ActionConfigBase.extend(
3251
+ z24.object({
3252
+ type: z24.literal(ActionType.NOTIFY)
3253
+ }).shape
3254
+ );
3218
3255
  var DeclareConfig = DeclarationActionBase.extend(
3219
3256
  z24.object({
3220
3257
  type: z24.literal(ActionType.DECLARE),
@@ -3239,6 +3276,11 @@ var ArchiveConfig = ActionConfigBase.extend(
3239
3276
  type: z24.literal(ActionType.ARCHIVE)
3240
3277
  }).shape
3241
3278
  );
3279
+ var UnarchiveConfig = ActionConfigBase.extend(
3280
+ z24.object({
3281
+ type: z24.literal(ActionType.UNARCHIVE)
3282
+ }).shape
3283
+ );
3242
3284
  var EditActionConfig = ActionConfigBase.extend(
3243
3285
  z24.object({
3244
3286
  type: z24.literal(ActionType.EDIT),
@@ -3299,9 +3341,13 @@ var ActionConfig = z24.discriminatedUnion("type", [
3299
3341
  id: "ReadActionConfig",
3300
3342
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3301
3343
  }),
3344
+ NotifyConfig.meta({
3345
+ id: "NotifyActionConfig",
3346
+ description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
3347
+ }),
3302
3348
  DeclareConfig.meta({
3303
3349
  id: "DeclareActionConfig",
3304
- description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
3350
+ description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3305
3351
  }),
3306
3352
  RejectConfig.meta({
3307
3353
  id: "RejectActionConfig",
@@ -3327,6 +3373,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
3327
3373
  id: "ArchiveActionConfig",
3328
3374
  description: "Configuration for archiving a record."
3329
3375
  }),
3376
+ UnarchiveConfig.meta({
3377
+ id: "UnarchiveActionConfig",
3378
+ description: "Configuration for unarchiving a record."
3379
+ }),
3330
3380
  CustomActionConfig.meta({
3331
3381
  id: "CustomActionConfig",
3332
3382
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -3908,7 +3958,7 @@ var isHiddenFieldType = (field3) => {
3908
3958
  return field3.config.type === FieldType.ALPHA_HIDDEN;
3909
3959
  };
3910
3960
  var isNonInteractiveFieldType = (field3) => {
3911
- return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.HTTP || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.QUERY_PARAM_READER || field3.type === FieldType.LOADER;
3961
+ return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.LOADER;
3912
3962
  };
3913
3963
 
3914
3964
  // ../commons/src/conditionals/validate.ts
@@ -4470,13 +4520,13 @@ function getActionConfig({
4470
4520
  actionType,
4471
4521
  customActionType
4472
4522
  }) {
4523
+ if (actionType === ActionType.NOTIFY) {
4524
+ return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
4525
+ }
4473
4526
  return eventConfiguration.actions.find((a) => {
4474
4527
  if (a.type === ActionType.CUSTOM && customActionType) {
4475
4528
  return a.customActionType === customActionType;
4476
4529
  }
4477
- if (actionType === ActionType.NOTIFY) {
4478
- return a.type === ActionType.DECLARE;
4479
- }
4480
4530
  if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
4481
4531
  return a.type === ActionType.REQUEST_CORRECTION;
4482
4532
  }
@@ -4513,7 +4563,7 @@ var getActionAnnotationFields = (actionConfig) => {
4513
4563
  if (actionConfig.type === ActionType.CUSTOM) {
4514
4564
  return actionConfig.form;
4515
4565
  }
4516
- if ("review" in actionConfig) {
4566
+ if ("review" in actionConfig && actionConfig.review != null) {
4517
4567
  return actionConfig.review.fields;
4518
4568
  }
4519
4569
  return [];
@@ -6308,6 +6358,11 @@ var ArchiveActionInput = BaseActionInput.extend(
6308
6358
  content: ReasonContent
6309
6359
  }).shape
6310
6360
  );
6361
+ var UnarchiveActionInput = BaseActionInput.extend(
6362
+ z38.object({
6363
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
6364
+ }).shape
6365
+ );
6311
6366
  var AssignActionInput = BaseActionInput.extend(
6312
6367
  z38.object({
6313
6368
  type: z38.literal(ActionType.ASSIGN),
@@ -6369,6 +6424,7 @@ var ActionInput = z38.discriminatedUnion("type", [
6369
6424
  id: "MarkNotDuplicateActionInput"
6370
6425
  }),
6371
6426
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
6427
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
6372
6428
  AssignActionInput.meta({ id: "AssignActionInput" }),
6373
6429
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
6374
6430
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -6483,8 +6539,11 @@ var updateActions = ActionTypes.extract([
6483
6539
  ActionType.REGISTER,
6484
6540
  ActionType.REJECT,
6485
6541
  ActionType.ARCHIVE,
6542
+ ActionType.UNARCHIVE,
6486
6543
  ActionType.PRINT_CERTIFICATE,
6487
6544
  ActionType.REQUEST_CORRECTION,
6545
+ ActionType.APPROVE_CORRECTION,
6546
+ ActionType.REJECT_CORRECTION,
6488
6547
  ActionType.CUSTOM
6489
6548
  ]);
6490
6549
  function getActionUpdateMetadata(actions) {
@@ -6512,6 +6571,10 @@ function getActionUpdateMetadata(actions) {
6512
6571
  }
6513
6572
  function getLegalStatuses(actions) {
6514
6573
  return {
6574
+ [EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
6575
+ ActionType.NOTIFY,
6576
+ actions
6577
+ ),
6515
6578
  [EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
6516
6579
  ActionType.DECLARE,
6517
6580
  actions
@@ -6526,9 +6589,6 @@ function getLegalStatuses(actions) {
6526
6589
  // ../commons/src/events/state/flags.ts
6527
6590
  var import_lodash3 = require("lodash");
6528
6591
  var import_date_fns3 = require("date-fns");
6529
- function isEditInProgress(actions) {
6530
- return actions.at(-1)?.type === ActionType.EDIT;
6531
- }
6532
6592
  function findPendingCorrectionAction(writeActions2) {
6533
6593
  let correctionRequestAction;
6534
6594
  for (let i = writeActions2.length - 1; i >= 0; i--) {
@@ -6543,29 +6603,6 @@ function findPendingCorrectionAction(writeActions2) {
6543
6603
  }
6544
6604
  return correctionRequestAction;
6545
6605
  }
6546
- function isCorrectionRequested(actions) {
6547
- return findPendingCorrectionAction(actions) !== void 0;
6548
- }
6549
- function isDeclarationIncomplete(actions) {
6550
- return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
6551
- }
6552
- function isRejected(actions) {
6553
- const resettingActionTypes = [
6554
- ActionType.NOTIFY,
6555
- ActionType.DECLARE,
6556
- ActionType.EDIT,
6557
- ActionType.REGISTER
6558
- ];
6559
- return actions.reduce((prev, { type }) => {
6560
- if (type === ActionType.REJECT) {
6561
- return true;
6562
- }
6563
- if (resettingActionTypes.includes(type)) {
6564
- return false;
6565
- }
6566
- return prev;
6567
- }, false);
6568
- }
6569
6606
  function isPotentialDuplicate(actions) {
6570
6607
  return actions.reduce((prev, { type }) => {
6571
6608
  if (type === ActionType.DUPLICATE_DETECTED) {
@@ -6593,6 +6630,85 @@ function isFlagConditionMet(conditional, form, action) {
6593
6630
  }
6594
6631
  });
6595
6632
  }
6633
+ function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
6634
+ if (!isActionConfigType(action.type)) {
6635
+ return false;
6636
+ }
6637
+ const actionConfig = getActionConfig({
6638
+ eventConfiguration,
6639
+ actionType: action.type,
6640
+ customActionType: "customActionType" in action ? action.customActionType : void 0
6641
+ });
6642
+ const removeOperations = (actionConfig?.flags ?? []).filter(
6643
+ ({ id, operation }) => id === flagId && operation === "remove"
6644
+ );
6645
+ if (removeOperations.length === 0) {
6646
+ return false;
6647
+ }
6648
+ const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
6649
+ const declaration = aggregateActionDeclarations(eventUpToThisAction);
6650
+ const annotation = aggregateActionAnnotations(eventUpToThisAction);
6651
+ const form = { ...declaration, ...annotation };
6652
+ return removeOperations.some(
6653
+ ({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
6654
+ );
6655
+ }
6656
+ var INHERENT_FLAG_RULES = [
6657
+ {
6658
+ flag: InherentFlags.CORRECTION_REQUESTED,
6659
+ setOn: [ActionType.REQUEST_CORRECTION],
6660
+ resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
6661
+ },
6662
+ {
6663
+ // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
6664
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
6665
+ // are deliberately excluded so the flag freezes across an archive/unarchive
6666
+ // round trip and comes back exactly as it was.
6667
+ flag: InherentFlags.INCOMPLETE,
6668
+ setOn: [ActionType.NOTIFY],
6669
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
6670
+ },
6671
+ {
6672
+ flag: InherentFlags.REJECTED,
6673
+ setOn: [ActionType.REJECT],
6674
+ resetOn: [
6675
+ ActionType.NOTIFY,
6676
+ ActionType.DECLARE,
6677
+ ActionType.EDIT,
6678
+ ActionType.REGISTER
6679
+ ]
6680
+ },
6681
+ {
6682
+ flag: InherentFlags.POTENTIAL_DUPLICATE,
6683
+ setOn: [ActionType.DUPLICATE_DETECTED],
6684
+ resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
6685
+ },
6686
+ {
6687
+ flag: InherentFlags.EDIT_IN_PROGRESS,
6688
+ setOn: [ActionType.EDIT],
6689
+ resetOnAnyOtherAction: true
6690
+ }
6691
+ ];
6692
+ function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
6693
+ return acceptedActions.reduce((present, action, idx) => {
6694
+ if (rule.setOn.includes(action.type)) {
6695
+ return true;
6696
+ }
6697
+ if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
6698
+ return false;
6699
+ }
6700
+ if (actionConfigRemovesFlag(
6701
+ action,
6702
+ rule.flag,
6703
+ acceptedActions.slice(0, idx + 1),
6704
+ event2,
6705
+ eventConfiguration
6706
+ )) {
6707
+ return false;
6708
+ }
6709
+ return present;
6710
+ }, false);
6711
+ }
6596
6712
  function resolveEventCustomFlags(event2, eventConfiguration) {
6597
6713
  const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6598
6714
  return actions.reduce((acc, action, idx) => {
@@ -6641,40 +6757,46 @@ function getActionStatusFlags(sortedActions) {
6641
6757
  return flag2;
6642
6758
  });
6643
6759
  }
6644
- function getInherentFlags(sortedActions) {
6760
+ function getInherentFlags(sortedActions, event2, eventConfiguration) {
6645
6761
  const acceptedActions = sortedActions.filter(
6646
6762
  ({ status: status2 }) => status2 === ActionStatus.Accepted
6647
6763
  );
6648
- const inherentFlags = [];
6649
- if (isCorrectionRequested(acceptedActions)) {
6650
- inherentFlags.push(InherentFlags.CORRECTION_REQUESTED);
6651
- }
6652
- if (isDeclarationIncomplete(acceptedActions)) {
6653
- inherentFlags.push(InherentFlags.INCOMPLETE);
6654
- }
6655
- if (isRejected(acceptedActions)) {
6656
- inherentFlags.push(InherentFlags.REJECTED);
6657
- }
6658
- if (isPotentialDuplicate(acceptedActions)) {
6659
- inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
6660
- }
6661
- if (isEditInProgress(acceptedActions)) {
6662
- inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
6663
- }
6664
- return inherentFlags;
6764
+ return INHERENT_FLAG_RULES.filter(
6765
+ (rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
6766
+ ).map(({ flag: flag2 }) => flag2);
6665
6767
  }
6666
6768
  function getEventFlags(event2, config) {
6667
6769
  const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6668
6770
  return [
6669
6771
  ...getActionStatusFlags(sortedActions),
6670
- ...getInherentFlags(sortedActions),
6772
+ ...getInherentFlags(sortedActions, event2, config),
6671
6773
  ...resolveEventCustomFlags(event2, config)
6672
6774
  ];
6673
6775
  }
6674
6776
 
6675
6777
  // ../commons/src/events/state/index.ts
6676
6778
  function getStatusFromActions(actions) {
6677
- return actions.filter(({ status: status2 }) => status2 === ActionStatus.Accepted).reduce((status2, action) => {
6779
+ const acceptedActions = actions.filter(
6780
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
6781
+ );
6782
+ const isCurrentlyArchived = acceptedActions.reduce(
6783
+ (archived, action) => {
6784
+ if (action.type === ActionType.ARCHIVE) {
6785
+ return true;
6786
+ }
6787
+ if (action.type === ActionType.UNARCHIVE) {
6788
+ return false;
6789
+ }
6790
+ return archived;
6791
+ },
6792
+ false
6793
+ );
6794
+ if (isCurrentlyArchived) {
6795
+ return EventStatus.enum.ARCHIVED;
6796
+ }
6797
+ return acceptedActions.filter(
6798
+ ({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
6799
+ ).reduce((status2, action) => {
6678
6800
  switch (action.type) {
6679
6801
  case ActionType.CREATE:
6680
6802
  return EventStatus.enum.CREATED;
@@ -6682,10 +6804,11 @@ function getStatusFromActions(actions) {
6682
6804
  return EventStatus.enum.DECLARED;
6683
6805
  case ActionType.REGISTER:
6684
6806
  return EventStatus.enum.REGISTERED;
6685
- case ActionType.ARCHIVE:
6686
- return EventStatus.enum.ARCHIVED;
6687
6807
  case ActionType.NOTIFY:
6688
6808
  return EventStatus.enum.NOTIFIED;
6809
+ // Already filtered out above; listed here only to satisfy exhaustiveness.
6810
+ case ActionType.ARCHIVE:
6811
+ case ActionType.UNARCHIVE:
6689
6812
  case ActionType.CUSTOM:
6690
6813
  case ActionType.PRINT_CERTIFICATE:
6691
6814
  case ActionType.ASSIGN:
@@ -7672,6 +7795,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
7672
7795
  id: "signature.upload.modal.title",
7673
7796
  defaultMessage: "Draw signature",
7674
7797
  description: "Title for the modal to draw signature"
7798
+ },
7799
+ // Zod applies the schema default at parse time, but this fixture bypasses
7800
+ // parsing — GeneratedInputField accesses configuration.maxFileSize directly.
7801
+ configuration: {
7802
+ maxFileSize: 5 * 1024 * 1024
7675
7803
  }
7676
7804
  }
7677
7805
  ]
@@ -8228,6 +8356,20 @@ var tennisClubMembershipEvent = defineConfig({
8228
8356
  },
8229
8357
  review: TENNIS_CLUB_DECLARATION_REVIEW
8230
8358
  },
8359
+ {
8360
+ type: ActionType.NOTIFY,
8361
+ label: {
8362
+ defaultMessage: "Notify health worker",
8363
+ description: "This is shown as the action name anywhere the user can trigger the action from",
8364
+ id: "event.tennis-club-membership.action.notify.label"
8365
+ },
8366
+ flags: [
8367
+ {
8368
+ id: "health-worker-notified",
8369
+ operation: "add"
8370
+ }
8371
+ ]
8372
+ },
8231
8373
  {
8232
8374
  type: ActionType.REJECT,
8233
8375
  label: {
@@ -8470,6 +8612,17 @@ var tennisClubMembershipEvent = defineConfig({
8470
8612
  }
8471
8613
  }
8472
8614
  ],
8615
+ flags: [
8616
+ {
8617
+ id: "health-worker-notified",
8618
+ requiresAction: false,
8619
+ label: {
8620
+ id: "event.tennis-club-membership.flag.health-worker-notified.label",
8621
+ defaultMessage: "Health worker notified",
8622
+ description: "Label for the health-worker-notified flag"
8623
+ }
8624
+ }
8625
+ ],
8473
8626
  advancedSearch: [
8474
8627
  {
8475
8628
  title: {
@@ -9740,6 +9893,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
9740
9893
  },
9741
9894
  ...input
9742
9895
  }),
9896
+ unarchive: (eventId, input = {}) => ({
9897
+ type: ActionType.UNARCHIVE,
9898
+ transactionId: input.transactionId ?? getUUID(),
9899
+ declaration: {},
9900
+ annotation: {},
9901
+ eventId,
9902
+ ...input
9903
+ }),
9743
9904
  reject: (eventId, input = {}) => ({
9744
9905
  type: ActionType.REJECT,
9745
9906
  transactionId: input.transactionId ?? getUUID(),
@@ -9898,6 +10059,7 @@ function generateActionDocument({
9898
10059
  case ActionType.NOTIFY:
9899
10060
  case ActionType.REGISTER:
9900
10061
  case ActionType.REQUEST_CORRECTION:
10062
+ case ActionType.UNARCHIVE:
9901
10063
  return { ...actionBase, type: action };
9902
10064
  case ActionType.EDIT:
9903
10065
  return {
@@ -10228,7 +10390,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
10228
10390
  return locationIds.some((id) => id === user2.primaryOfficeId);
10229
10391
  }
10230
10392
  if (filter === JurisdictionFilter.enum.administrativeArea) {
10231
- return user2.administrativeAreaId === null || locationIds.some((id) => id === user2.administrativeAreaId);
10393
+ return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
10232
10394
  }
10233
10395
  return true;
10234
10396
  }
@@ -10255,6 +10417,25 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
10255
10417
  }
10256
10418
  if (scopeUsesDeclaredOptions(scope)) {
10257
10419
  const { options } = scope;
10420
+ if (options?.notifiedBy === UserFilter.enum.user) {
10421
+ if (event2.legalStatuses?.NOTIFIED?.createdBy !== user2.id) {
10422
+ return false;
10423
+ }
10424
+ }
10425
+ if (options?.notifiedIn === JurisdictionFilter.enum.location && !matchesJurisdictionFilter(
10426
+ event2.legalStatuses?.NOTIFIED?.createdAtLocation,
10427
+ JurisdictionFilter.enum.location,
10428
+ user2
10429
+ )) {
10430
+ return false;
10431
+ }
10432
+ if (options?.notifiedIn === JurisdictionFilter.enum.administrativeArea && !matchesJurisdictionFilter(
10433
+ event2.legalStatuses?.NOTIFIED?.createdAtLocation,
10434
+ JurisdictionFilter.enum.administrativeArea,
10435
+ user2
10436
+ )) {
10437
+ return false;
10438
+ }
10258
10439
  if (options?.declaredBy === UserFilter.enum.user) {
10259
10440
  if (event2.legalStatuses?.DECLARED?.createdBy !== user2.id) {
10260
10441
  return false;
@@ -10317,7 +10498,7 @@ function canAccessUserWithScope({
10317
10498
  }
10318
10499
  const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
10319
10500
  (id) => user2.administrativeAreaId === id
10320
- ) || user2.administrativeAreaId === null;
10501
+ ) || !user2.administrativeAreaId;
10321
10502
  if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
10322
10503
  return false;
10323
10504
  }
@@ -10397,6 +10578,7 @@ var ACTION_SCOPE_MAP = {
10397
10578
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
10398
10579
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
10399
10580
  [ActionType.ARCHIVE]: ["record.archive"],
10581
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
10400
10582
  [ActionType.REJECT]: ["record.reject"],
10401
10583
  [ActionType.ASSIGN]: null,
10402
10584
  [ActionType.UNASSIGN]: null,
@@ -10603,7 +10785,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
10603
10785
  ActionType.CUSTOM,
10604
10786
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
10605
10787
  ],
10606
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
10788
+ [EventStatus.enum.ARCHIVED]: [
10789
+ ActionType.READ,
10790
+ ActionType.CUSTOM,
10791
+ ActionType.UNARCHIVE
10792
+ ]
10607
10793
  };
10608
10794
  var ACTION_FILTERS = {
10609
10795
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
@@ -10616,6 +10802,7 @@ var ACTION_FILTERS = {
10616
10802
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
10617
10803
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
10618
10804
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10805
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10619
10806
  [ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10620
10807
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10621
10808
  [ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
@@ -10623,18 +10810,19 @@ var ACTION_FILTERS = {
10623
10810
  function filterActionsByFlags(actions, flags) {
10624
10811
  return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
10625
10812
  }
10813
+ var REJECTED_ACTIONS = [
10814
+ ActionType.READ,
10815
+ ActionType.NOTIFY,
10816
+ ActionType.CUSTOM,
10817
+ ActionType.EDIT,
10818
+ ActionType.ARCHIVE
10819
+ ];
10626
10820
  function getAvailableActionsWithoutFlagFilters(status2, flags) {
10627
10821
  if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
10628
10822
  return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
10629
10823
  }
10630
- if (flags.includes(InherentFlags.REJECTED)) {
10631
- return [
10632
- ActionType.READ,
10633
- ActionType.NOTIFY,
10634
- ActionType.CUSTOM,
10635
- ActionType.EDIT,
10636
- ActionType.ARCHIVE
10637
- ];
10824
+ if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
10825
+ return REJECTED_ACTIONS;
10638
10826
  }
10639
10827
  return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
10640
10828
  }
@@ -1,5 +1,5 @@
1
1
  export declare const UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
2
- export declare const UPSTREAM_BRANCH = "release-v2.0.0";
2
+ export declare const UPSTREAM_BRANCH = "release/2.0.0";
3
3
  /**
4
4
  * Runs a git command in the country config working directory.
5
5
  *