@opencrvs/toolkit 2.1.0-rc.0ec4a9a → 2.1.0-rc.18100e3

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 (70) hide show
  1. package/dist/application-config/index.js +201 -191
  2. package/dist/cli.js +48 -0
  3. package/dist/commons/api/router.d.ts +1645 -1631
  4. package/dist/commons/application-config/index.d.ts +6 -6
  5. package/dist/commons/conditionals/conditionals.d.ts +323 -32
  6. package/dist/commons/conditionals/validate.d.ts +2 -1
  7. package/dist/commons/events/ActionConfig.d.ts +126 -105
  8. package/dist/commons/events/ActionDocument.d.ts +117 -123
  9. package/dist/commons/events/ActionInput.d.ts +6 -0
  10. package/dist/commons/events/ActionStatus.d.ts +14 -0
  11. package/dist/commons/events/ActionType.d.ts +62 -62
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -507
  13. package/dist/commons/events/AuditLog.d.ts +43 -43
  14. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  15. package/dist/commons/events/Conditional.d.ts +3 -3
  16. package/dist/commons/events/CountryConfigQueryInput.d.ts +608 -590
  17. package/dist/commons/events/Draft.d.ts +37 -37
  18. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  19. package/dist/commons/events/EventConfig.d.ts +5 -5
  20. package/dist/commons/events/EventDocument.d.ts +48 -48
  21. package/dist/commons/events/EventIndex.d.ts +52 -71
  22. package/dist/commons/events/EventMetadata.d.ts +41 -40
  23. package/dist/commons/events/FieldConfig.d.ts +342 -337
  24. package/dist/commons/events/FieldType.d.ts +51 -51
  25. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  26. package/dist/commons/events/FieldValue.d.ts +12 -12
  27. package/dist/commons/events/Flag.d.ts +63 -15
  28. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  29. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  30. package/dist/commons/events/WorkqueueConfig.d.ts +835 -820
  31. package/dist/commons/events/deduplication.d.ts +1 -1
  32. package/dist/commons/events/event.d.ts +2 -2
  33. package/dist/commons/events/field.d.ts +198 -69
  34. package/dist/commons/events/locations.d.ts +6 -99
  35. package/dist/commons/events/mocks.test.utils.d.ts +4 -20
  36. package/dist/commons/events/scopes.d.ts +4 -4
  37. package/dist/commons/events/state/index.d.ts +17 -17
  38. package/dist/commons/events/state/utils.d.ts +7 -7
  39. package/dist/commons/events/test.utils.d.ts +43 -40
  40. package/dist/commons/events/utils.d.ts +114 -114
  41. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  42. package/dist/conditionals/index.js +303 -55
  43. package/dist/environment/derived-variables.d.ts +131 -119
  44. package/dist/environment/derived-variables.d.ts.map +1 -1
  45. package/dist/environment/derived-variables.js +14 -0
  46. package/dist/environment/logger.d.ts +12 -3
  47. package/dist/environment/logger.d.ts.map +1 -1
  48. package/dist/environment/manage-users.js +7 -17
  49. package/dist/environment/questions.d.ts +74 -75
  50. package/dist/environment/questions.d.ts.map +1 -1
  51. package/dist/environment/setup-environment.js +28 -8
  52. package/dist/environment/swarm-to-k8s.js +7 -17
  53. package/dist/environment/update-workflows.js +7 -17
  54. package/dist/environment/users.js +7 -17
  55. package/dist/environment/utils.d.ts +1 -1
  56. package/dist/environment/utils.js +7 -17
  57. package/dist/events/deduplication.d.ts +1 -1
  58. package/dist/events/index.js +3274 -3241
  59. package/dist/migrations/v2.0/convert-config-files-to-ts.js +7 -17
  60. package/dist/migrations/v2.0/migrate-application-config-url.js +3 -4
  61. package/dist/migrations/v2.0/remove-hearth-migrations.js +7 -17
  62. package/dist/notification/index.js +1482 -913
  63. package/dist/scopes/index.d.ts +396 -146
  64. package/dist/scopes/index.js +304 -55
  65. package/dist/templates/charts-values/dependencies/values.yaml +3 -0
  66. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -0
  67. package/opencrvs-toolkit-2.1.0-rc.18100e3.tgz +0 -0
  68. package/package.json +4 -3
  69. package/tsconfig.tsbuildinfo +1 -1
  70. package/opencrvs-toolkit-2.1.0-rc.0ec4a9a.tgz +0 -0
@@ -500,7 +500,7 @@ var import_v4 = require("zod/v4");
500
500
  var z15 = __toESM(require("zod/v4"));
501
501
 
502
502
  // ../commons/src/events/ActionDocument.ts
503
- var z13 = __toESM(require("zod/v4"));
503
+ var z14 = __toESM(require("zod/v4"));
504
504
 
505
505
  // ../commons/src/events/ActionType.ts
506
506
  var z10 = __toESM(require("zod/v4"));
@@ -612,16 +612,89 @@ var META_ACTIONS = [
612
612
 
613
613
  // ../commons/src/authentication.ts
614
614
  var import_jwt_decode = __toESM(require("jwt-decode"));
615
- var z12 = __toESM(require("zod/v4"));
615
+ var z13 = __toESM(require("zod/v4"));
616
616
 
617
617
  // ../commons/src/scopes.ts
618
- var z11 = __toESM(require("zod/v4"));
618
+ var z12 = __toESM(require("zod/v4"));
619
619
  var qs = __toESM(require("qs"));
620
- var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
620
+
621
+ // ../commons/src/events/ActionStatus.ts
622
+ var ActionStatus = {
623
+ Requested: "Requested",
624
+ Accepted: "Accepted",
625
+ Rejected: "Rejected"
626
+ };
627
+
628
+ // ../commons/src/events/Flag.ts
629
+ var z11 = __toESM(require("zod/v4"));
630
+ var InherentFlags = {
631
+ INCOMPLETE: "incomplete",
632
+ REJECTED: "rejected",
633
+ CORRECTION_REQUESTED: "correction-requested",
634
+ POTENTIAL_DUPLICATE: "potential-duplicate",
635
+ /**
636
+ * This flag is set by the Edit-action and removed after the declaration or registration.
637
+ * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
638
+ *
639
+ * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
640
+ */
641
+ EDIT_IN_PROGRESS: "edit-in-progress",
642
+ SEALED: "sealed"
643
+ };
644
+ var actionFlagPattern;
645
+ function getActionFlagPattern() {
646
+ actionFlagPattern ??= new RegExp(
647
+ `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
648
+ ActionStatus
649
+ ).join("|").toLowerCase()})$`
650
+ );
651
+ return actionFlagPattern;
652
+ }
653
+ var ActionFlag = z11.string().refine((value) => getActionFlagPattern().test(value), {
654
+ message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
655
+ });
656
+ var CustomFlag = z11.string().refine((val) => !Object.values(InherentFlags).includes(val), {
657
+ message: `Custom flag cannot be one of the inherent flags: ${Object.values(
658
+ InherentFlags
659
+ ).join(", ")}`
660
+ }).refine((val) => !ActionFlag.safeParse(val).success, {
661
+ message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
662
+ }).describe("Custom flag identifier defined by the country config.");
663
+ var Flag = ActionFlag.or(z11.enum(InherentFlags)).or(CustomFlag);
664
+ var ContainsFlags = z11.object({
665
+ anyOf: z11.array(Flag).optional(),
666
+ noneOf: z11.array(Flag).optional(),
667
+ allOf: z11.array(Flag).optional()
668
+ }).meta({
669
+ id: "ContainsFlags"
670
+ });
671
+ var FlagConfig = z11.object({
672
+ id: CustomFlag,
673
+ requiresAction: z11.boolean().describe(
674
+ "Indicates if this flag expects an action to be performed to be cleared."
675
+ ),
676
+ label: TranslationConfig.describe("Human readable label of the flag.")
677
+ }).meta({
678
+ id: "FlagConfig",
679
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
680
+ });
681
+ var ActionFlagConfig = z11.object({
682
+ id: Flag,
683
+ operation: z11.enum(["add", "remove"]).describe("Operation to perform on the flag."),
684
+ conditional: Conditional.optional().describe(
685
+ "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
686
+ )
687
+ }).meta({
688
+ id: "ActionFlagConfig",
689
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
690
+ });
691
+
692
+ // ../commons/src/scopes.ts
693
+ var JurisdictionFilter = z12.enum(["administrativeArea", "location", "all"]).describe(
621
694
  "Filters based on user jurisdiction relative to their office location in hierarchy."
622
695
  );
623
- var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
624
- var RecordScopeTypeV2 = z11.enum([
696
+ var UserFilter = z12.enum(["user"]).describe("Filters based on the user. Limits to self.");
697
+ var RecordScopeTypeV2 = z12.enum([
625
698
  "record.search",
626
699
  "record.create",
627
700
  "record.read",
@@ -639,7 +712,7 @@ var RecordScopeTypeV2 = z11.enum([
639
712
  "record.unassign-others",
640
713
  "record.custom-action"
641
714
  ]);
642
- var PlainScopeType = z11.enum([
715
+ var PlainScopeType = z12.enum([
643
716
  // Misc. system scopes
644
717
  "bypassratelimit",
645
718
  "record.reindex",
@@ -658,15 +731,15 @@ var PlainScopeType = z11.enum([
658
731
  "record.confirm-registration",
659
732
  "record.reject-registration"
660
733
  ]);
661
- var scopeByEvent = z11.preprocess(
734
+ var scopeByEvent = z12.preprocess(
662
735
  (val) => val === void 0 ? void 0 : [val].flat(),
663
- z11.array(z11.string()).optional()
736
+ z12.array(z12.string()).optional()
664
737
  ).describe("Event type, e.g. birth, death");
665
- var userRole = z11.preprocess(
738
+ var userRole = z12.preprocess(
666
739
  (val) => val === void 0 ? void 0 : [val].flat(),
667
- z11.array(z11.string()).optional()
740
+ z12.array(z12.string()).optional()
668
741
  ).describe("User role, e.g. admin, field agent");
669
- var scopeOptionsPlaceEvent = z11.object({
742
+ var scopeOptionsPlaceEvent = z12.object({
670
743
  event: scopeByEvent,
671
744
  placeOfEvent: JurisdictionFilter.optional()
672
745
  }).describe("Options applicable to all record scopes.");
@@ -678,36 +751,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
678
751
  }).describe("Options applicable to actions that may take place after DECLARE");
679
752
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
680
753
  registeredIn: JurisdictionFilter.optional(),
681
- registeredBy: UserFilter.optional()
754
+ registeredBy: UserFilter.optional(),
755
+ flags: ContainsFlags.optional()
682
756
  }).describe(
683
757
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
684
758
  );
685
759
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
686
- customActionTypes: z11.preprocess(
760
+ customActionTypes: z12.preprocess(
687
761
  (val) => val === void 0 ? void 0 : [val].flat(),
688
- z11.array(z11.string()).optional()
762
+ z12.array(z12.string()).optional()
689
763
  ).describe("Allowed custom action types")
690
764
  });
691
- var AccessLevelOptions = z11.object({
765
+ var AccessLevelOptions = z12.object({
692
766
  accessLevel: JurisdictionFilter.optional()
693
767
  });
694
768
  var AllUserScopeOptions = AccessLevelOptions.extend({
695
769
  role: userRole.optional()
696
770
  });
697
- var WorkqueueOrDashboardOptions = z11.object({
698
- ids: z11.preprocess(
771
+ var WorkqueueOrDashboardOptions = z12.object({
772
+ ids: z12.preprocess(
699
773
  (val) => val === void 0 ? void 0 : [val].flat(),
700
- z11.array(z11.string())
774
+ z12.array(z12.string())
701
775
  ).describe("Must contain a list of workqueue or dashboard ids.")
702
776
  });
703
- var AllScopeOptions = z11.object({
777
+ var AllScopeOptions = z12.object({
704
778
  ...AllRecordScopeOptions.shape,
705
779
  ...AccessLevelOptions.shape,
706
780
  ...AllUserScopeOptions.shape,
707
781
  ...WorkqueueOrDashboardOptions.shape
708
782
  });
709
783
  var ScopeOptionKey = AllScopeOptions.keyof();
710
- var ResolvedScopeOptionsPlaceEvent = z11.object({
784
+ var ResolvedScopeOptionsPlaceEvent = z12.object({
711
785
  event: scopeByEvent,
712
786
  placeOfEvent: UUID.nullish()
713
787
  }).describe(
@@ -715,15 +789,16 @@ var ResolvedScopeOptionsPlaceEvent = z11.object({
715
789
  );
716
790
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
717
791
  notifiedIn: UUID.nullish(),
718
- notifiedBy: z11.string().optional(),
792
+ notifiedBy: z12.string().optional(),
719
793
  declaredIn: UUID.nullish(),
720
- declaredBy: z11.string().optional()
794
+ declaredBy: z12.string().optional()
721
795
  }).describe(
722
796
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
723
797
  );
724
798
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
725
799
  registeredIn: UUID.nullish(),
726
- registeredBy: z11.string().optional()
800
+ registeredBy: z12.string().optional(),
801
+ flags: ContainsFlags.optional()
727
802
  }).describe(
728
803
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
729
804
  );
@@ -748,38 +823,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
748
823
  "record.unassign-others"
749
824
  ]);
750
825
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
751
- templates: z11.preprocess(
826
+ templates: z12.preprocess(
752
827
  (val) => val === void 0 ? void 0 : [val].flat(),
753
- z11.array(z11.string()).optional()
828
+ z12.array(z12.string()).optional()
754
829
  ).describe(
755
830
  "Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
756
831
  )
757
832
  });
758
- var RecordScopeV2 = z11.discriminatedUnion("type", [
759
- z11.object({
833
+ var RecordScopeV2 = z12.discriminatedUnion("type", [
834
+ z12.object({
760
835
  type: ScopesWithPlaceEventOptions,
761
836
  options: scopeOptionsPlaceEvent.optional()
762
837
  }),
763
- z11.object({
838
+ z12.object({
764
839
  type: ScopesWithDeclaredOptions,
765
840
  options: scopeOptionsDeclaredOrNotified.optional()
766
841
  }),
767
- z11.object({
842
+ z12.object({
768
843
  type: ScopesWithFullOptions,
769
844
  options: AllRecordScopeOptions.optional()
770
845
  }),
771
- z11.object({
772
- type: z11.literal("record.custom-action"),
846
+ z12.object({
847
+ type: z12.literal("record.custom-action"),
773
848
  options: CustomActionScopeOptions.optional()
774
849
  }),
775
- z11.object({
776
- type: z11.literal("record.print-certified-copies"),
850
+ z12.object({
851
+ type: z12.literal("record.print-certified-copies"),
777
852
  options: ScopeOptionsPrintCertifiedCopies.optional()
778
853
  })
779
854
  ]).describe(
780
855
  "Scopes used to check user's permission to perform actions on a record."
781
856
  );
782
- var SystemScopeType = z11.enum([
857
+ var SystemScopeType = z12.enum([
783
858
  "organisation.read-locations",
784
859
  "user.read",
785
860
  "user.create",
@@ -793,61 +868,61 @@ var UserScopeType = SystemScopeType.extract([
793
868
  "user.search"
794
869
  ]);
795
870
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
796
- var UserScopeV2 = z11.discriminatedUnion("type", [
797
- z11.object({
871
+ var UserScopeV2 = z12.discriminatedUnion("type", [
872
+ z12.object({
798
873
  type: ScopesWithRoleOption,
799
874
  options: AllUserScopeOptions.optional()
800
875
  }),
801
- z11.object({
876
+ z12.object({
802
877
  type: UserScopeType.extract(["user.read", "user.search"]),
803
878
  options: AccessLevelOptions.optional()
804
879
  })
805
880
  ]);
806
- var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
807
- z11.object({
881
+ var ResolvedRecordScopeV2 = z12.discriminatedUnion("type", [
882
+ z12.object({
808
883
  type: ScopesWithPlaceEventOptions,
809
884
  options: ResolvedScopeOptionsPlaceEvent.optional()
810
885
  }),
811
- z11.object({
886
+ z12.object({
812
887
  type: ScopesWithDeclaredOptions,
813
888
  options: ResolvedScopeOptionsDeclared.optional()
814
889
  }),
815
- z11.object({
890
+ z12.object({
816
891
  type: ScopesWithFullOptions,
817
892
  options: ResolvedScopeOptionsFull.optional()
818
893
  }),
819
- z11.object({
820
- type: z11.literal("record.print-certified-copies"),
894
+ z12.object({
895
+ type: z12.literal("record.print-certified-copies"),
821
896
  options: ResolvedScopeOptionsFull.extend({
822
- templates: z11.array(z11.string()).optional()
897
+ templates: z12.array(z12.string()).optional()
823
898
  }).optional()
824
899
  })
825
900
  ]).describe("Resolved scope with location/user IDs instead of filters.");
826
- var Scope = z11.discriminatedUnion("type", [
827
- z11.object({ type: PlainScopeType }),
901
+ var Scope = z12.discriminatedUnion("type", [
902
+ z12.object({ type: PlainScopeType }),
828
903
  ...RecordScopeV2.options,
829
904
  ...UserScopeV2.options,
830
- z11.object({
831
- type: z11.literal("organisation.read-locations"),
905
+ z12.object({
906
+ type: z12.literal("organisation.read-locations"),
832
907
  options: AccessLevelOptions.optional()
833
908
  }),
834
- z11.object({
835
- type: z11.literal("workqueue"),
909
+ z12.object({
910
+ type: z12.literal("workqueue"),
836
911
  options: WorkqueueOrDashboardOptions
837
912
  }),
838
- z11.object({
839
- type: z11.literal("dashboard.view"),
913
+ z12.object({
914
+ type: z12.literal("dashboard.view"),
840
915
  options: WorkqueueOrDashboardOptions
841
916
  })
842
917
  ]);
843
- var ScopeType = z11.enum([
918
+ var ScopeType = z12.enum([
844
919
  ...SystemScopeType.options,
845
920
  ...RecordScopeTypeV2.options,
846
921
  ...PlainScopeType.options,
847
922
  "workqueue",
848
923
  "dashboard.view"
849
924
  ]);
850
- var EncodedScope = z11.string().brand("EncodedScope");
925
+ var EncodedScope = z12.string().brand("EncodedScope");
851
926
  var DEFAULT_SCOPE_OPTIONS = {
852
927
  placeOfEvent: JurisdictionFilter.enum.all,
853
928
  accessLevel: JurisdictionFilter.enum.all,
@@ -857,30 +932,25 @@ var DEFAULT_SCOPE_OPTIONS = {
857
932
  };
858
933
 
859
934
  // ../commons/src/authentication.ts
860
- var TokenUserType = z12.enum(["user", "system"]);
861
- var TokenWithBearer = z12.string().regex(/^Bearer\s/);
935
+ var TokenUserType = z13.enum(["user", "system"]);
936
+ var TokenWithBearer = z13.string().regex(/^Bearer\s/);
862
937
 
863
938
  // ../commons/src/events/ActionDocument.ts
864
- var ActionUpdate = z13.record(z13.string(), FieldUpdateValue).describe(
939
+ var ActionUpdate = z14.record(z14.string(), FieldUpdateValue).describe(
865
940
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
866
941
  );
867
- var EventState = z13.record(z13.string(), FieldValue).describe(
942
+ var EventState = z14.record(z14.string(), FieldValue).describe(
868
943
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
869
944
  );
870
- var ActionStatus = {
871
- Requested: "Requested",
872
- Accepted: "Accepted",
873
- Rejected: "Rejected"
874
- };
875
- var ActionBase = z13.object({
945
+ var ActionBase = z14.object({
876
946
  id: UUID.describe("Unique identifier of the action."),
877
- transactionId: z13.string().describe("Unique identifier of the transaction."),
947
+ transactionId: z14.string().describe("Unique identifier of the transaction."),
878
948
  createdByUserType: TokenUserType.describe(
879
949
  "Indicates whether the action was created by a human-user or by a system-user."
880
950
  ),
881
- createdAt: z13.string().datetime().describe("Timestamp indicating when the action was created."),
882
- createdBy: z13.string().describe("Identifier of the user who created the action."),
883
- createdByRole: z13.string().optional().describe("Role of the user who created the action."),
951
+ createdAt: z14.string().datetime().describe("Timestamp indicating when the action was created."),
952
+ createdBy: z14.string().describe("Identifier of the user who created the action."),
953
+ createdByRole: z14.string().optional().describe("Role of the user who created the action."),
884
954
  createdBySignature: DocumentPath.nullish().describe(
885
955
  "Reference to the signature of the user who created the action."
886
956
  ),
@@ -892,7 +962,7 @@ var ActionBase = z13.object({
892
962
  "Declaration data defined by the ActionConfig. Supports partial updates."
893
963
  ),
894
964
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
895
- status: z13.enum([
965
+ status: z14.enum([
896
966
  ActionStatus.Requested,
897
967
  ActionStatus.Accepted,
898
968
  ActionStatus.Rejected
@@ -904,139 +974,138 @@ var ActionBase = z13.object({
904
974
  )
905
975
  });
906
976
  var AssignedAction = ActionBase.extend(
907
- z13.object({
908
- type: z13.literal(ActionType.ASSIGN),
909
- assignedTo: z13.string().describe("Identifier of the user to whom the action is assigned.")
977
+ z14.object({
978
+ type: z14.literal(ActionType.ASSIGN),
979
+ assignedTo: z14.string().describe("Identifier of the user to whom the action is assigned.")
910
980
  // TODO move into 'content' property
911
981
  }).shape
912
982
  );
913
983
  var UnassignedAction = ActionBase.extend(
914
- z13.object({
915
- type: z13.literal(ActionType.UNASSIGN)
984
+ z14.object({
985
+ type: z14.literal(ActionType.UNASSIGN)
916
986
  }).shape
917
987
  );
918
988
  var RegisterAction = ActionBase.extend(
919
- z13.object({
920
- type: z13.literal(ActionType.REGISTER),
921
- registrationNumber: z13.string().optional().describe(
989
+ z14.object({
990
+ type: z14.literal(ActionType.REGISTER),
991
+ registrationNumber: z14.string().optional().describe(
922
992
  "Registration number of the event. Always present for accepted registrations."
923
993
  )
924
994
  // TODO move into 'content' property
925
995
  }).shape
926
996
  );
927
997
  var DeclareAction = ActionBase.extend(
928
- z13.object({
929
- type: z13.literal(ActionType.DECLARE)
998
+ z14.object({
999
+ type: z14.literal(ActionType.DECLARE)
930
1000
  }).shape
931
1001
  );
932
- var ReasonContent = z13.object({
933
- reason: z13.string().min(1, { error: "Message cannot be empty" }).describe(
1002
+ var ReasonContent = z14.object({
1003
+ reason: z14.string().min(1, { error: "Message cannot be empty" }).describe(
934
1004
  "Message describing the reason for rejecting or archiving the event."
935
1005
  )
936
1006
  });
937
1007
  var RejectAction = ActionBase.extend(
938
- z13.object({
939
- type: z13.literal(ActionType.REJECT),
1008
+ z14.object({
1009
+ type: z14.literal(ActionType.REJECT),
940
1010
  content: ReasonContent
941
1011
  }).shape
942
1012
  );
943
- var PotentialDuplicate = z13.object({
1013
+ var PotentialDuplicate = z14.object({
944
1014
  id: UUID,
945
- trackingId: z13.string()
1015
+ trackingId: z14.string()
946
1016
  });
947
1017
  var DuplicateDetectedAction = ActionBase.extend(
948
- z13.object({
949
- type: z13.literal(ActionType.DUPLICATE_DETECTED),
950
- content: z13.object({
951
- duplicates: z13.array(PotentialDuplicate)
1018
+ z14.object({
1019
+ type: z14.literal(ActionType.DUPLICATE_DETECTED),
1020
+ content: z14.object({
1021
+ duplicates: z14.array(PotentialDuplicate)
952
1022
  })
953
1023
  }).shape
954
1024
  );
955
1025
  var MarkNotDuplicateAction = ActionBase.extend(
956
- z13.object({
957
- type: z13.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1026
+ z14.object({
1027
+ type: z14.literal(ActionType.MARK_AS_NOT_DUPLICATE)
958
1028
  }).shape
959
1029
  );
960
1030
  var MarkAsDuplicateAction = ActionBase.extend(
961
- z13.object({
962
- type: z13.literal(ActionType.MARK_AS_DUPLICATE),
963
- content: z13.object({
1031
+ z14.object({
1032
+ type: z14.literal(ActionType.MARK_AS_DUPLICATE),
1033
+ content: z14.object({
964
1034
  duplicateOf: UUID
965
1035
  }).optional()
966
1036
  }).shape
967
1037
  );
968
1038
  var ArchiveAction = ActionBase.extend(
969
- z13.object({
970
- type: z13.literal(ActionType.ARCHIVE),
1039
+ z14.object({
1040
+ type: z14.literal(ActionType.ARCHIVE),
971
1041
  content: ReasonContent
972
1042
  }).shape
973
1043
  );
974
1044
  var UnarchiveAction = ActionBase.extend(
975
- z13.object({
976
- type: z13.literal(ActionType.UNARCHIVE)
1045
+ z14.object({
1046
+ type: z14.literal(ActionType.UNARCHIVE)
977
1047
  }).shape
978
1048
  );
979
1049
  var CreatedAction = ActionBase.extend(
980
- z13.object({
981
- type: z13.literal(ActionType.CREATE)
1050
+ z14.object({
1051
+ type: z14.literal(ActionType.CREATE)
982
1052
  }).shape
983
1053
  );
984
1054
  var NotifiedAction = ActionBase.extend(
985
- z13.object({
986
- type: z13.literal(ActionType.NOTIFY)
1055
+ z14.object({
1056
+ type: z14.literal(ActionType.NOTIFY)
987
1057
  }).shape
988
1058
  );
989
1059
  var EditAction = ActionBase.extend(
990
- z13.object({
991
- type: z13.literal(ActionType.EDIT),
992
- /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
993
- content: z13.object({
994
- comment: z13.string().describe("Comment for the edit action.").optional()
995
- }).optional()
1060
+ z14.object({
1061
+ type: z14.literal(ActionType.EDIT),
1062
+ content: z14.object({
1063
+ comment: z14.string().describe("Comment for the edit action.").optional()
1064
+ })
996
1065
  }).shape
997
1066
  );
998
- var PrintContent = z13.object({
999
- templateId: z13.string().optional()
1067
+ var PrintContent = z14.object({
1068
+ templateId: z14.string().optional()
1000
1069
  });
1001
1070
  var PrintCertificateAction = ActionBase.extend(
1002
- z13.object({
1003
- type: z13.literal(ActionType.PRINT_CERTIFICATE),
1071
+ z14.object({
1072
+ type: z14.literal(ActionType.PRINT_CERTIFICATE),
1004
1073
  content: PrintContent.optional().nullable()
1005
1074
  }).shape
1006
1075
  );
1007
1076
  var RequestedCorrectionAction = ActionBase.extend(
1008
- z13.object({
1009
- type: z13.literal(ActionType.REQUEST_CORRECTION)
1077
+ z14.object({
1078
+ type: z14.literal(ActionType.REQUEST_CORRECTION)
1010
1079
  }).shape
1011
1080
  );
1012
1081
  var ApprovedCorrectionAction = ActionBase.extend(
1013
- z13.object({
1014
- type: z13.literal(ActionType.APPROVE_CORRECTION),
1015
- requestId: z13.string(),
1082
+ z14.object({
1083
+ type: z14.literal(ActionType.APPROVE_CORRECTION),
1084
+ requestId: z14.string(),
1016
1085
  // TODO move into 'content' property
1017
- content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
1086
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1018
1087
  }).shape
1019
1088
  );
1020
1089
  var RejectedCorrectionAction = ActionBase.extend(
1021
- z13.object({
1022
- type: z13.literal(ActionType.REJECT_CORRECTION),
1023
- requestId: z13.string(),
1090
+ z14.object({
1091
+ type: z14.literal(ActionType.REJECT_CORRECTION),
1092
+ requestId: z14.string(),
1024
1093
  // TODO move into 'content' property
1025
1094
  content: ReasonContent
1026
1095
  }).shape
1027
1096
  );
1028
1097
  var ReadAction = ActionBase.extend(
1029
- z13.object({
1030
- type: z13.literal(ActionType.READ)
1098
+ z14.object({
1099
+ type: z14.literal(ActionType.READ)
1031
1100
  }).shape
1032
1101
  );
1033
1102
  var CustomAction = ActionBase.merge(
1034
- z13.object({
1035
- type: z13.literal(ActionType.CUSTOM),
1036
- customActionType: z13.string()
1103
+ z14.object({
1104
+ type: z14.literal(ActionType.CUSTOM),
1105
+ customActionType: z14.string()
1037
1106
  })
1038
1107
  );
1039
- var ActionDocument = z13.discriminatedUnion("type", [
1108
+ var ActionDocument = z14.discriminatedUnion("type", [
1040
1109
  CreatedAction.meta({ id: "CreatedAction" }),
1041
1110
  RejectAction.meta({ id: "RejectAction" }),
1042
1111
  DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
@@ -1063,64 +1132,12 @@ var AsyncRejectActionDocument = ActionBase.omit({
1063
1132
  declaration: true,
1064
1133
  annotation: true
1065
1134
  }).extend(
1066
- z13.object({
1067
- type: z13.enum(ConfirmableActions),
1068
- status: z13.literal(ActionStatus.Rejected)
1135
+ z14.object({
1136
+ type: z14.enum(ConfirmableActions),
1137
+ status: z14.literal(ActionStatus.Rejected)
1069
1138
  }).shape
1070
1139
  );
1071
- var Action = z13.union([ActionDocument, AsyncRejectActionDocument]);
1072
-
1073
- // ../commons/src/events/Flag.ts
1074
- var z14 = __toESM(require("zod/v4"));
1075
- var InherentFlags = {
1076
- INCOMPLETE: "incomplete",
1077
- REJECTED: "rejected",
1078
- CORRECTION_REQUESTED: "correction-requested",
1079
- POTENTIAL_DUPLICATE: "potential-duplicate",
1080
- /**
1081
- * This flag is set by the Edit-action and removed after the declaration or registration.
1082
- * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
1083
- *
1084
- * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
1085
- */
1086
- EDIT_IN_PROGRESS: "edit-in-progress"
1087
- };
1088
- var ActionFlag = z14.string().regex(
1089
- new RegExp(
1090
- `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
1091
- ActionStatus
1092
- ).join("|").toLowerCase()})$`
1093
- ),
1094
- "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1095
- );
1096
- var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1097
- message: `Custom flag cannot be one of the inherent flags: ${Object.values(
1098
- InherentFlags
1099
- ).join(", ")}`
1100
- }).refine((val) => !ActionFlag.safeParse(val).success, {
1101
- message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
1102
- }).describe("Custom flag identifier defined by the country config.");
1103
- var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
1104
- var FlagConfig = z14.object({
1105
- id: CustomFlag,
1106
- requiresAction: z14.boolean().describe(
1107
- "Indicates if this flag expects an action to be performed to be cleared."
1108
- ),
1109
- label: TranslationConfig.describe("Human readable label of the flag.")
1110
- }).meta({
1111
- id: "FlagConfig",
1112
- description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1113
- });
1114
- var ActionFlagConfig = z14.object({
1115
- id: Flag,
1116
- operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1117
- conditional: Conditional.optional().describe(
1118
- "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1119
- )
1120
- }).meta({
1121
- id: "ActionFlagConfig",
1122
- description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1123
- });
1140
+ var Action = z14.union([ActionDocument, AsyncRejectActionDocument]);
1124
1141
 
1125
1142
  // ../commons/src/events/EventMetadata.ts
1126
1143
  var EventStatus = z15.enum([
@@ -1281,13 +1298,6 @@ var Range = import_v4.z.object({
1281
1298
  }).meta({
1282
1299
  id: "Range"
1283
1300
  });
1284
- var ContainsFlags = import_v4.z.object({
1285
- anyOf: import_v4.z.array(Flag).optional(),
1286
- noneOf: import_v4.z.array(Flag).optional(),
1287
- allOf: import_v4.z.array(Flag).optional()
1288
- }).meta({
1289
- id: "ContainsFlags"
1290
- });
1291
1301
  var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
1292
1302
  id: "Within"
1293
1303
  });