@opencrvs/toolkit 2.1.0-rc.75e32d8 → 2.1.0-rc.7737766

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 (134) hide show
  1. package/README.md +1 -0
  2. package/build.sh +9 -1
  3. package/create-countryconfig/index.js +412 -59
  4. package/create-countryconfig/node_modules/.bin/degit +21 -0
  5. package/create-countryconfig/package.json +4 -1
  6. package/dist/application-config/index.js +349 -277
  7. package/dist/authentication/index.d.ts +67 -0
  8. package/dist/authentication/index.d.ts.map +1 -0
  9. package/dist/authentication/index.js +754 -0
  10. package/dist/cli.js +1782 -113
  11. package/dist/commons/api/router.d.ts +3976 -3374
  12. package/dist/commons/application-config/index.d.ts +6 -6
  13. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  14. package/dist/commons/conditionals/validate.d.ts +16 -5
  15. package/dist/commons/events/ActionConfig.d.ts +109 -105
  16. package/dist/commons/events/ActionDocument.d.ts +121 -127
  17. package/dist/commons/events/ActionInput.d.ts +4 -10
  18. package/dist/commons/events/ActionStatus.d.ts +14 -0
  19. package/dist/commons/events/ActionType.d.ts +62 -62
  20. package/dist/commons/events/AdvancedSearchConfig.d.ts +543 -507
  21. package/dist/commons/events/AuditLog.d.ts +189 -42
  22. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  23. package/dist/commons/events/Conditional.d.ts +3 -3
  24. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  25. package/dist/commons/events/Draft.d.ts +37 -37
  26. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  27. package/dist/commons/events/EventConfig.d.ts +8 -5
  28. package/dist/commons/events/EventDocument.d.ts +518 -50
  29. package/dist/commons/events/EventIndex.d.ts +49 -72
  30. package/dist/commons/events/EventMetadata.d.ts +39 -49
  31. package/dist/commons/events/EventStatus.d.ts +19 -0
  32. package/dist/commons/events/FieldConfig.d.ts +434 -389
  33. package/dist/commons/events/FieldType.d.ts +51 -51
  34. package/dist/commons/events/FieldTypeMapping.d.ts +86 -86
  35. package/dist/commons/events/FieldValue.d.ts +14 -14
  36. package/dist/commons/events/Flag.d.ts +57 -15
  37. package/dist/commons/events/FormConfig.d.ts +6 -0
  38. package/dist/commons/events/PageConfig.d.ts +4 -0
  39. package/dist/commons/events/PlainDate.d.ts +8 -0
  40. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  41. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  42. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  43. package/dist/commons/events/WorkqueueConfig.d.ts +817 -814
  44. package/dist/commons/events/deduplication.d.ts +1 -1
  45. package/dist/commons/events/event.d.ts +14 -2
  46. package/dist/commons/events/field.d.ts +69 -198
  47. package/dist/commons/events/index.d.ts +1 -0
  48. package/dist/commons/events/locationPayloads.d.ts +95 -0
  49. package/dist/commons/events/locations.d.ts +247 -14
  50. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  51. package/dist/commons/events/scopes.d.ts +4 -4
  52. package/dist/commons/events/state/index.d.ts +17 -17
  53. package/dist/commons/events/state/utils.d.ts +7 -7
  54. package/dist/commons/events/test.utils.d.ts +64 -46
  55. package/dist/commons/events/utils.d.ts +129 -114
  56. package/dist/commons/notification/UserNotifications.d.ts +38 -23
  57. package/dist/commons/notification/dispatch.d.ts +10 -0
  58. package/dist/commons/notification/index.d.ts +1 -0
  59. package/dist/conditionals/index.js +334 -60
  60. package/dist/csv.d.ts +25 -0
  61. package/dist/csv.d.ts.map +1 -0
  62. package/dist/csv.js +120 -0
  63. package/dist/environment/derived-variables.d.ts +119 -119
  64. package/dist/environment/derived-variables.d.ts.map +1 -1
  65. package/dist/environment/index.d.ts +1 -0
  66. package/dist/environment/index.d.ts.map +1 -1
  67. package/dist/environment/index.js +10 -0
  68. package/dist/environment/logger.d.ts +6 -3
  69. package/dist/environment/logger.d.ts.map +1 -1
  70. package/dist/environment/manage-users.js +17 -7
  71. package/dist/environment/paths.d.ts +7 -0
  72. package/dist/environment/paths.d.ts.map +1 -0
  73. package/dist/environment/paths.js +72 -0
  74. package/dist/environment/questions.d.ts +75 -74
  75. package/dist/environment/questions.d.ts.map +1 -1
  76. package/dist/environment/questions.js +20 -14
  77. package/dist/environment/setup-environment.js +36 -21
  78. package/dist/environment/swarm-to-k8s.js +17 -7
  79. package/dist/environment/templates.d.ts.map +1 -1
  80. package/dist/environment/templates.js +2 -1
  81. package/dist/environment/update-workflows.d.ts.map +1 -1
  82. package/dist/environment/update-workflows.js +34 -12
  83. package/dist/environment/upgrade.d.ts +2 -0
  84. package/dist/environment/upgrade.d.ts.map +1 -0
  85. package/dist/environment/upgrade.js +82 -0
  86. package/dist/environment/users.js +28 -20
  87. package/dist/environment/utils.d.ts +1 -1
  88. package/dist/environment/utils.js +17 -7
  89. package/dist/events/deduplication.d.ts +1 -1
  90. package/dist/events/index.js +7641 -7128
  91. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  92. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  93. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  94. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  95. package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
  96. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  97. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  98. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  99. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  100. package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
  101. package/dist/migrations/v2.1/add-translations.d.ts +9 -0
  102. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
  103. package/dist/migrations/v2.1/add-translations.js +213 -0
  104. package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
  105. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  106. package/dist/migrations/v2.1/enable-telemetry.js +438 -0
  107. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  108. package/dist/migrations/v2.1/index.js +1058 -0
  109. package/dist/notification/index.js +1870 -1464
  110. package/dist/scopes/index.d.ts +560 -157
  111. package/dist/scopes/index.js +335 -60
  112. package/dist/telemetry/index.d.ts +45 -0
  113. package/dist/telemetry/index.d.ts.map +1 -0
  114. package/dist/telemetry/index.js +39 -0
  115. package/dist/templates/charts-values/dependencies/values.yaml +2 -0
  116. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  117. package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
  118. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  119. package/dist/templates/inventory/inventory.template.yml +1 -3
  120. package/dist/translations/check.d.ts +21 -0
  121. package/dist/translations/check.d.ts.map +1 -0
  122. package/dist/translations/check.js +132 -0
  123. package/dist/verify/endpoints.d.ts +2 -0
  124. package/dist/verify/endpoints.d.ts.map +1 -0
  125. package/dist/verify/endpoints.js +345 -0
  126. package/opencrvs-toolkit-2.1.0-rc.7737766.tgz +0 -0
  127. package/package.json +12 -7
  128. package/tsconfig.build.json +11 -0
  129. package/tsconfig.build.tsbuildinfo +1 -0
  130. package/tsconfig.json +3 -0
  131. package/dist/templates/inventory/production.example.yml +0 -77
  132. package/dist/templates/inventory/qa.example.yml +0 -48
  133. package/opencrvs-toolkit-2.1.0-rc.75e32d8.tgz +0 -0
  134. package/tsconfig.tsbuildinfo +0 -1
@@ -42,7 +42,7 @@ __export(application_config_exports, {
42
42
  module.exports = __toCommonJS(application_config_exports);
43
43
 
44
44
  // ../commons/src/application-config.ts
45
- var z20 = __toESM(require("zod/v4"));
45
+ var z21 = __toESM(require("zod/v4"));
46
46
 
47
47
  // ../commons/src/events/FieldConfig.ts
48
48
  var import_v43 = __toESM(require("zod/v4"));
@@ -497,10 +497,10 @@ var SerializedUserField = z9.object({
497
497
  var import_v4 = require("zod/v4");
498
498
 
499
499
  // ../commons/src/events/EventMetadata.ts
500
- var z15 = __toESM(require("zod/v4"));
500
+ var z16 = __toESM(require("zod/v4"));
501
501
 
502
502
  // ../commons/src/events/ActionDocument.ts
503
- var z13 = __toESM(require("zod/v4"));
503
+ var z15 = __toESM(require("zod/v4"));
504
504
 
505
505
  // ../commons/src/events/ActionType.ts
506
506
  var z10 = __toESM(require("zod/v4"));
@@ -612,16 +612,98 @@ 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 z14 = __toESM(require("zod/v4"));
616
616
 
617
617
  // ../commons/src/scopes.ts
618
- var z11 = __toESM(require("zod/v4"));
618
+ var z13 = __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
+ };
643
+ var actionFlagPattern;
644
+ function getActionFlagPattern() {
645
+ actionFlagPattern ??= new RegExp(
646
+ `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
647
+ ActionStatus
648
+ ).join("|").toLowerCase()})$`
649
+ );
650
+ return actionFlagPattern;
651
+ }
652
+ var ActionFlag = z11.string().refine((value) => getActionFlagPattern().test(value), {
653
+ message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
654
+ });
655
+ var CustomFlag = z11.string().refine((val) => !Object.values(InherentFlags).includes(val), {
656
+ message: `Custom flag cannot be one of the inherent flags: ${Object.values(
657
+ InherentFlags
658
+ ).join(", ")}`
659
+ }).refine((val) => !ActionFlag.safeParse(val).success, {
660
+ message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
661
+ }).describe("Custom flag identifier defined by the country config.");
662
+ var Flag = ActionFlag.or(z11.enum(InherentFlags)).or(CustomFlag);
663
+ var ContainsFlags = z11.object({
664
+ anyOf: z11.array(Flag).optional(),
665
+ noneOf: z11.array(Flag).optional(),
666
+ allOf: z11.array(Flag).optional()
667
+ }).meta({
668
+ id: "ContainsFlags"
669
+ });
670
+ var FlagConfig = z11.object({
671
+ id: CustomFlag,
672
+ requiresAction: z11.boolean().describe(
673
+ "Indicates if this flag expects an action to be performed to be cleared."
674
+ ),
675
+ label: TranslationConfig.describe("Human readable label of the flag.")
676
+ }).meta({
677
+ id: "FlagConfig",
678
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
679
+ });
680
+ var ActionFlagConfig = z11.object({
681
+ id: Flag,
682
+ operation: z11.enum(["add", "remove"]).describe("Operation to perform on the flag."),
683
+ conditional: Conditional.optional().describe(
684
+ "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
685
+ )
686
+ }).meta({
687
+ id: "ActionFlagConfig",
688
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
689
+ });
690
+
691
+ // ../commons/src/events/EventStatus.ts
692
+ var z12 = __toESM(require("zod/v4"));
693
+ var EventStatus = z12.enum([
694
+ "CREATED",
695
+ "NOTIFIED",
696
+ "DECLARED",
697
+ "REGISTERED",
698
+ "ARCHIVED"
699
+ ]);
700
+
701
+ // ../commons/src/scopes.ts
702
+ var JurisdictionFilter = z13.enum(["administrativeArea", "location", "all"]).describe(
621
703
  "Filters based on user jurisdiction relative to their office location in hierarchy."
622
704
  );
623
- var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
624
- var RecordScopeTypeV2 = z11.enum([
705
+ var UserFilter = z13.enum(["user"]).describe("Filters based on the user. Limits to self.");
706
+ var RecordScopeTypeV2 = z13.enum([
625
707
  "record.search",
626
708
  "record.create",
627
709
  "record.read",
@@ -639,14 +721,20 @@ var RecordScopeTypeV2 = z11.enum([
639
721
  "record.unassign-others",
640
722
  "record.custom-action"
641
723
  ]);
642
- var PlainScopeType = z11.enum([
724
+ var PlainScopeType = z13.enum([
643
725
  // Misc. system scopes
644
726
  "bypassratelimit",
645
727
  "record.reindex",
646
728
  "user.data-seeding",
647
729
  "integration.create",
730
+ // Reading an integration's audit log. Deliberately separate from
731
+ // 'integration.create' so read-only oversight can be granted on its own, and
732
+ // deliberately option-less: system clients have no office and no
733
+ // administrative area, so jurisdiction options would have nothing to bind to.
734
+ "integration.audit.read",
648
735
  "record.import",
649
736
  "config.update-all",
737
+ "location.edit",
650
738
  "attachment.upload",
651
739
  "profile.electronic-signature",
652
740
  "user.read-only-my-audit",
@@ -658,72 +746,85 @@ var PlainScopeType = z11.enum([
658
746
  "record.confirm-registration",
659
747
  "record.reject-registration"
660
748
  ]);
661
- var scopeByEvent = z11.preprocess(
749
+ var scopeByEvent = z13.preprocess(
662
750
  (val) => val === void 0 ? void 0 : [val].flat(),
663
- z11.array(z11.string()).optional()
751
+ z13.array(z13.string()).optional()
664
752
  ).describe("Event type, e.g. birth, death");
665
- var userRole = z11.preprocess(
753
+ var scopeByStatus = z13.preprocess(
754
+ (val) => val === void 0 ? void 0 : [val].flat(),
755
+ z13.array(EventStatus).optional()
756
+ ).describe(
757
+ "Restricts the scope to records currently in one of these statuses."
758
+ );
759
+ var userRole = z13.preprocess(
666
760
  (val) => val === void 0 ? void 0 : [val].flat(),
667
- z11.array(z11.string()).optional()
761
+ z13.array(z13.string()).optional()
668
762
  ).describe("User role, e.g. admin, field agent");
669
- var scopeOptionsPlaceEvent = z11.object({
763
+ var scopeOptionsPlaceEvent = z13.object({
670
764
  event: scopeByEvent,
671
- placeOfEvent: JurisdictionFilter.optional()
765
+ placeOfEvent: JurisdictionFilter.optional(),
766
+ createdBy: UserFilter.optional(),
767
+ createdIn: JurisdictionFilter.optional()
672
768
  }).describe("Options applicable to all record scopes.");
673
769
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
674
770
  notifiedIn: JurisdictionFilter.optional(),
675
771
  notifiedBy: UserFilter.optional(),
676
772
  declaredIn: JurisdictionFilter.optional(),
677
- declaredBy: UserFilter.optional()
773
+ declaredBy: UserFilter.optional(),
774
+ status: scopeByStatus
678
775
  }).describe("Options applicable to actions that may take place after DECLARE");
679
776
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
680
777
  registeredIn: JurisdictionFilter.optional(),
681
- registeredBy: UserFilter.optional()
778
+ registeredBy: UserFilter.optional(),
779
+ flags: ContainsFlags.optional()
682
780
  }).describe(
683
781
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
684
782
  );
685
783
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
686
- customActionTypes: z11.preprocess(
784
+ customActionTypes: z13.preprocess(
687
785
  (val) => val === void 0 ? void 0 : [val].flat(),
688
- z11.array(z11.string()).optional()
786
+ z13.array(z13.string()).optional()
689
787
  ).describe("Allowed custom action types")
690
788
  });
691
- var AccessLevelOptions = z11.object({
789
+ var AccessLevelOptions = z13.object({
692
790
  accessLevel: JurisdictionFilter.optional()
693
791
  });
694
792
  var AllUserScopeOptions = AccessLevelOptions.extend({
695
793
  role: userRole.optional()
696
794
  });
697
- var WorkqueueOrDashboardOptions = z11.object({
698
- ids: z11.preprocess(
795
+ var WorkqueueOrDashboardOptions = z13.object({
796
+ ids: z13.preprocess(
699
797
  (val) => val === void 0 ? void 0 : [val].flat(),
700
- z11.array(z11.string())
798
+ z13.array(z13.string())
701
799
  ).describe("Must contain a list of workqueue or dashboard ids.")
702
800
  });
703
- var AllScopeOptions = z11.object({
801
+ var AllScopeOptions = z13.object({
704
802
  ...AllRecordScopeOptions.shape,
705
803
  ...AccessLevelOptions.shape,
706
804
  ...AllUserScopeOptions.shape,
707
805
  ...WorkqueueOrDashboardOptions.shape
708
806
  });
709
807
  var ScopeOptionKey = AllScopeOptions.keyof();
710
- var ResolvedScopeOptionsPlaceEvent = z11.object({
808
+ var ResolvedScopeOptionsPlaceEvent = z13.object({
711
809
  event: scopeByEvent,
712
- placeOfEvent: UUID.nullish()
810
+ placeOfEvent: UUID.nullish(),
811
+ createdBy: z13.string().optional(),
812
+ createdIn: UUID.nullish()
713
813
  }).describe(
714
814
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
715
815
  );
716
816
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
717
817
  notifiedIn: UUID.nullish(),
718
- notifiedBy: z11.string().optional(),
818
+ notifiedBy: z13.string().optional(),
719
819
  declaredIn: UUID.nullish(),
720
- declaredBy: z11.string().optional()
820
+ declaredBy: z13.string().optional()
721
821
  }).describe(
722
822
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
723
823
  );
724
824
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
725
825
  registeredIn: UUID.nullish(),
726
- registeredBy: z11.string().optional()
826
+ registeredBy: z13.string().optional(),
827
+ flags: ContainsFlags.optional()
727
828
  }).describe(
728
829
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
729
830
  );
@@ -737,7 +838,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
737
838
  "record.reject",
738
839
  "record.archive",
739
840
  "record.unarchive",
740
- "record.review-duplicates",
741
841
  "record.register"
742
842
  ]);
743
843
  var ScopesWithFullOptions = RecordScopeTypeV2.extract([
@@ -745,41 +845,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
745
845
  "record.read",
746
846
  "record.request-correction",
747
847
  "record.correct",
748
- "record.unassign-others"
848
+ "record.unassign-others",
849
+ "record.review-duplicates"
749
850
  ]);
750
851
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
751
- templates: z11.preprocess(
852
+ templates: z13.preprocess(
752
853
  (val) => val === void 0 ? void 0 : [val].flat(),
753
- z11.array(z11.string()).optional()
854
+ z13.array(z13.string()).optional()
754
855
  ).describe(
755
856
  "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
857
  )
757
858
  });
758
- var RecordScopeV2 = z11.discriminatedUnion("type", [
759
- z11.object({
859
+ var RecordScopeV2 = z13.discriminatedUnion("type", [
860
+ z13.object({
760
861
  type: ScopesWithPlaceEventOptions,
761
862
  options: scopeOptionsPlaceEvent.optional()
762
863
  }),
763
- z11.object({
864
+ z13.object({
764
865
  type: ScopesWithDeclaredOptions,
765
866
  options: scopeOptionsDeclaredOrNotified.optional()
766
867
  }),
767
- z11.object({
868
+ z13.object({
768
869
  type: ScopesWithFullOptions,
769
870
  options: AllRecordScopeOptions.optional()
770
871
  }),
771
- z11.object({
772
- type: z11.literal("record.custom-action"),
872
+ z13.object({
873
+ type: z13.literal("record.custom-action"),
773
874
  options: CustomActionScopeOptions.optional()
774
875
  }),
775
- z11.object({
776
- type: z11.literal("record.print-certified-copies"),
876
+ z13.object({
877
+ type: z13.literal("record.print-certified-copies"),
777
878
  options: ScopeOptionsPrintCertifiedCopies.optional()
778
879
  })
779
880
  ]).describe(
780
881
  "Scopes used to check user's permission to perform actions on a record."
781
882
  );
782
- var SystemScopeType = z11.enum([
883
+ var SystemScopeType = z13.enum([
783
884
  "organisation.read-locations",
784
885
  "user.read",
785
886
  "user.create",
@@ -793,61 +894,61 @@ var UserScopeType = SystemScopeType.extract([
793
894
  "user.search"
794
895
  ]);
795
896
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
796
- var UserScopeV2 = z11.discriminatedUnion("type", [
797
- z11.object({
897
+ var UserScopeV2 = z13.discriminatedUnion("type", [
898
+ z13.object({
798
899
  type: ScopesWithRoleOption,
799
900
  options: AllUserScopeOptions.optional()
800
901
  }),
801
- z11.object({
902
+ z13.object({
802
903
  type: UserScopeType.extract(["user.read", "user.search"]),
803
904
  options: AccessLevelOptions.optional()
804
905
  })
805
906
  ]);
806
- var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
807
- z11.object({
907
+ var ResolvedRecordScopeV2 = z13.discriminatedUnion("type", [
908
+ z13.object({
808
909
  type: ScopesWithPlaceEventOptions,
809
910
  options: ResolvedScopeOptionsPlaceEvent.optional()
810
911
  }),
811
- z11.object({
912
+ z13.object({
812
913
  type: ScopesWithDeclaredOptions,
813
914
  options: ResolvedScopeOptionsDeclared.optional()
814
915
  }),
815
- z11.object({
916
+ z13.object({
816
917
  type: ScopesWithFullOptions,
817
918
  options: ResolvedScopeOptionsFull.optional()
818
919
  }),
819
- z11.object({
820
- type: z11.literal("record.print-certified-copies"),
920
+ z13.object({
921
+ type: z13.literal("record.print-certified-copies"),
821
922
  options: ResolvedScopeOptionsFull.extend({
822
- templates: z11.array(z11.string()).optional()
923
+ templates: z13.array(z13.string()).optional()
823
924
  }).optional()
824
925
  })
825
926
  ]).describe("Resolved scope with location/user IDs instead of filters.");
826
- var Scope = z11.discriminatedUnion("type", [
827
- z11.object({ type: PlainScopeType }),
927
+ var Scope = z13.discriminatedUnion("type", [
928
+ z13.object({ type: PlainScopeType }),
828
929
  ...RecordScopeV2.options,
829
930
  ...UserScopeV2.options,
830
- z11.object({
831
- type: z11.literal("organisation.read-locations"),
931
+ z13.object({
932
+ type: z13.literal("organisation.read-locations"),
832
933
  options: AccessLevelOptions.optional()
833
934
  }),
834
- z11.object({
835
- type: z11.literal("workqueue"),
935
+ z13.object({
936
+ type: z13.literal("workqueue"),
836
937
  options: WorkqueueOrDashboardOptions
837
938
  }),
838
- z11.object({
839
- type: z11.literal("dashboard.view"),
939
+ z13.object({
940
+ type: z13.literal("dashboard.view"),
840
941
  options: WorkqueueOrDashboardOptions
841
942
  })
842
943
  ]);
843
- var ScopeType = z11.enum([
944
+ var ScopeType = z13.enum([
844
945
  ...SystemScopeType.options,
845
946
  ...RecordScopeTypeV2.options,
846
947
  ...PlainScopeType.options,
847
948
  "workqueue",
848
949
  "dashboard.view"
849
950
  ]);
850
- var EncodedScope = z11.string().brand("EncodedScope");
951
+ var EncodedScope = z13.string().brand("EncodedScope");
851
952
  var DEFAULT_SCOPE_OPTIONS = {
852
953
  placeOfEvent: JurisdictionFilter.enum.all,
853
954
  accessLevel: JurisdictionFilter.enum.all,
@@ -857,30 +958,25 @@ var DEFAULT_SCOPE_OPTIONS = {
857
958
  };
858
959
 
859
960
  // ../commons/src/authentication.ts
860
- var TokenUserType = z12.enum(["user", "system"]);
861
- var TokenWithBearer = z12.string().regex(/^Bearer\s/);
961
+ var TokenUserType = z14.enum(["user", "system"]);
962
+ var TokenWithBearer = z14.string().regex(/^Bearer\s/);
862
963
 
863
964
  // ../commons/src/events/ActionDocument.ts
864
- var ActionUpdate = z13.record(z13.string(), FieldUpdateValue).describe(
965
+ var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
865
966
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
866
967
  );
867
- var EventState = z13.record(z13.string(), FieldValue).describe(
968
+ var EventState = z15.record(z15.string(), FieldValue).describe(
868
969
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
869
970
  );
870
- var ActionStatus = {
871
- Requested: "Requested",
872
- Accepted: "Accepted",
873
- Rejected: "Rejected"
874
- };
875
- var ActionBase = z13.object({
971
+ var ActionBase = z15.object({
876
972
  id: UUID.describe("Unique identifier of the action."),
877
- transactionId: z13.string().describe("Unique identifier of the transaction."),
973
+ transactionId: z15.string().describe("Unique identifier of the transaction."),
878
974
  createdByUserType: TokenUserType.describe(
879
975
  "Indicates whether the action was created by a human-user or by a system-user."
880
976
  ),
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."),
977
+ createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
978
+ createdBy: z15.string().describe("Identifier of the user who created the action."),
979
+ createdByRole: z15.string().optional().describe("Role of the user who created the action."),
884
980
  createdBySignature: DocumentPath.nullish().describe(
885
981
  "Reference to the signature of the user who created the action."
886
982
  ),
@@ -892,7 +988,7 @@ var ActionBase = z13.object({
892
988
  "Declaration data defined by the ActionConfig. Supports partial updates."
893
989
  ),
894
990
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
895
- status: z13.enum([
991
+ status: z15.enum([
896
992
  ActionStatus.Requested,
897
993
  ActionStatus.Accepted,
898
994
  ActionStatus.Rejected
@@ -904,138 +1000,143 @@ var ActionBase = z13.object({
904
1000
  )
905
1001
  });
906
1002
  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.")
1003
+ z15.object({
1004
+ type: z15.literal(ActionType.ASSIGN),
1005
+ assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
910
1006
  // TODO move into 'content' property
911
1007
  }).shape
912
1008
  );
913
1009
  var UnassignedAction = ActionBase.extend(
914
- z13.object({
915
- type: z13.literal(ActionType.UNASSIGN)
1010
+ z15.object({
1011
+ type: z15.literal(ActionType.UNASSIGN)
916
1012
  }).shape
917
1013
  );
918
1014
  var RegisterAction = ActionBase.extend(
919
- z13.object({
920
- type: z13.literal(ActionType.REGISTER),
921
- registrationNumber: z13.string().optional().describe(
1015
+ z15.object({
1016
+ type: z15.literal(ActionType.REGISTER),
1017
+ registrationNumber: z15.string().optional().describe(
922
1018
  "Registration number of the event. Always present for accepted registrations."
923
1019
  )
924
1020
  // TODO move into 'content' property
925
1021
  }).shape
926
1022
  );
927
1023
  var DeclareAction = ActionBase.extend(
928
- z13.object({
929
- type: z13.literal(ActionType.DECLARE)
1024
+ z15.object({
1025
+ type: z15.literal(ActionType.DECLARE)
930
1026
  }).shape
931
1027
  );
932
- var ReasonContent = z13.object({
933
- reason: z13.string().min(1, { error: "Message cannot be empty" }).describe(
1028
+ var ReasonContent = z15.object({
1029
+ reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
934
1030
  "Message describing the reason for rejecting or archiving the event."
935
1031
  )
936
1032
  });
937
1033
  var RejectAction = ActionBase.extend(
938
- z13.object({
939
- type: z13.literal(ActionType.REJECT),
1034
+ z15.object({
1035
+ type: z15.literal(ActionType.REJECT),
940
1036
  content: ReasonContent
941
1037
  }).shape
942
1038
  );
943
- var PotentialDuplicate = z13.object({
1039
+ var PotentialDuplicate = z15.object({
944
1040
  id: UUID,
945
- trackingId: z13.string()
1041
+ trackingId: z15.string()
946
1042
  });
947
1043
  var DuplicateDetectedAction = ActionBase.extend(
948
- z13.object({
949
- type: z13.literal(ActionType.DUPLICATE_DETECTED),
950
- content: z13.object({
951
- duplicates: z13.array(PotentialDuplicate)
1044
+ z15.object({
1045
+ type: z15.literal(ActionType.DUPLICATE_DETECTED),
1046
+ content: z15.object({
1047
+ duplicates: z15.array(PotentialDuplicate)
952
1048
  })
953
1049
  }).shape
954
1050
  );
955
1051
  var MarkNotDuplicateAction = ActionBase.extend(
956
- z13.object({
957
- type: z13.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1052
+ z15.object({
1053
+ type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
958
1054
  }).shape
959
1055
  );
960
1056
  var MarkAsDuplicateAction = ActionBase.extend(
961
- z13.object({
962
- type: z13.literal(ActionType.MARK_AS_DUPLICATE),
963
- content: z13.object({
1057
+ z15.object({
1058
+ type: z15.literal(ActionType.MARK_AS_DUPLICATE),
1059
+ content: z15.object({
964
1060
  duplicateOf: UUID
965
1061
  }).optional()
966
1062
  }).shape
967
1063
  );
968
1064
  var ArchiveAction = ActionBase.extend(
969
- z13.object({
970
- type: z13.literal(ActionType.ARCHIVE),
971
- content: ReasonContent
1065
+ z15.object({
1066
+ type: z15.literal(ActionType.ARCHIVE),
1067
+ /**
1068
+ * Archiving does not collect a reason on its own. Only the
1069
+ * "mark as duplicate" flow archives with a reason attached.
1070
+ */
1071
+ content: ReasonContent.optional()
972
1072
  }).shape
973
1073
  );
974
1074
  var UnarchiveAction = ActionBase.extend(
975
- z13.object({
976
- type: z13.literal(ActionType.UNARCHIVE)
1075
+ z15.object({
1076
+ type: z15.literal(ActionType.UNARCHIVE)
977
1077
  }).shape
978
1078
  );
979
1079
  var CreatedAction = ActionBase.extend(
980
- z13.object({
981
- type: z13.literal(ActionType.CREATE)
1080
+ z15.object({
1081
+ type: z15.literal(ActionType.CREATE)
982
1082
  }).shape
983
1083
  );
984
1084
  var NotifiedAction = ActionBase.extend(
985
- z13.object({
986
- type: z13.literal(ActionType.NOTIFY)
1085
+ z15.object({
1086
+ type: z15.literal(ActionType.NOTIFY)
987
1087
  }).shape
988
1088
  );
989
1089
  var EditAction = ActionBase.extend(
990
- z13.object({
991
- type: z13.literal(ActionType.EDIT),
992
- content: z13.object({
993
- comment: z13.string().describe("Comment for the edit action.").optional()
994
- })
1090
+ z15.object({
1091
+ type: z15.literal(ActionType.EDIT),
1092
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1093
+ content: z15.object({
1094
+ comment: z15.string().describe("Comment for the edit action.").optional()
1095
+ }).optional()
995
1096
  }).shape
996
1097
  );
997
- var PrintContent = z13.object({
998
- templateId: z13.string().optional()
1098
+ var PrintContent = z15.object({
1099
+ templateId: z15.string().optional()
999
1100
  });
1000
1101
  var PrintCertificateAction = ActionBase.extend(
1001
- z13.object({
1002
- type: z13.literal(ActionType.PRINT_CERTIFICATE),
1102
+ z15.object({
1103
+ type: z15.literal(ActionType.PRINT_CERTIFICATE),
1003
1104
  content: PrintContent.optional().nullable()
1004
1105
  }).shape
1005
1106
  );
1006
1107
  var RequestedCorrectionAction = ActionBase.extend(
1007
- z13.object({
1008
- type: z13.literal(ActionType.REQUEST_CORRECTION)
1108
+ z15.object({
1109
+ type: z15.literal(ActionType.REQUEST_CORRECTION)
1009
1110
  }).shape
1010
1111
  );
1011
1112
  var ApprovedCorrectionAction = ActionBase.extend(
1012
- z13.object({
1013
- type: z13.literal(ActionType.APPROVE_CORRECTION),
1014
- requestId: z13.string(),
1113
+ z15.object({
1114
+ type: z15.literal(ActionType.APPROVE_CORRECTION),
1115
+ requestId: z15.string(),
1015
1116
  // TODO move into 'content' property
1016
- content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
1117
+ content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
1017
1118
  }).shape
1018
1119
  );
1019
1120
  var RejectedCorrectionAction = ActionBase.extend(
1020
- z13.object({
1021
- type: z13.literal(ActionType.REJECT_CORRECTION),
1022
- requestId: z13.string(),
1121
+ z15.object({
1122
+ type: z15.literal(ActionType.REJECT_CORRECTION),
1123
+ requestId: z15.string(),
1023
1124
  // TODO move into 'content' property
1024
1125
  content: ReasonContent
1025
1126
  }).shape
1026
1127
  );
1027
1128
  var ReadAction = ActionBase.extend(
1028
- z13.object({
1029
- type: z13.literal(ActionType.READ)
1129
+ z15.object({
1130
+ type: z15.literal(ActionType.READ)
1030
1131
  }).shape
1031
1132
  );
1032
1133
  var CustomAction = ActionBase.merge(
1033
- z13.object({
1034
- type: z13.literal(ActionType.CUSTOM),
1035
- customActionType: z13.string()
1134
+ z15.object({
1135
+ type: z15.literal(ActionType.CUSTOM),
1136
+ customActionType: z15.string()
1036
1137
  })
1037
1138
  );
1038
- var ActionDocument = z13.discriminatedUnion("type", [
1139
+ var ActionDocument = z15.discriminatedUnion("type", [
1039
1140
  CreatedAction.meta({ id: "CreatedAction" }),
1040
1141
  RejectAction.meta({ id: "RejectAction" }),
1041
1142
  DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
@@ -1062,109 +1163,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
1062
1163
  declaration: true,
1063
1164
  annotation: true
1064
1165
  }).extend(
1065
- z13.object({
1066
- type: z13.enum(ConfirmableActions),
1067
- status: z13.literal(ActionStatus.Rejected)
1166
+ z15.object({
1167
+ type: z15.enum(ConfirmableActions),
1168
+ status: z15.literal(ActionStatus.Rejected)
1068
1169
  }).shape
1069
1170
  );
1070
- var Action = z13.union([ActionDocument, AsyncRejectActionDocument]);
1071
-
1072
- // ../commons/src/events/Flag.ts
1073
- var z14 = __toESM(require("zod/v4"));
1074
- var InherentFlags = {
1075
- INCOMPLETE: "incomplete",
1076
- REJECTED: "rejected",
1077
- CORRECTION_REQUESTED: "correction-requested",
1078
- POTENTIAL_DUPLICATE: "potential-duplicate",
1079
- /**
1080
- * This flag is set by the Edit-action and removed after the declaration or registration.
1081
- * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
1082
- *
1083
- * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
1084
- */
1085
- EDIT_IN_PROGRESS: "edit-in-progress"
1086
- };
1087
- var ActionFlag = z14.string().regex(
1088
- new RegExp(
1089
- `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
1090
- ActionStatus
1091
- ).join("|").toLowerCase()})$`
1092
- ),
1093
- "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1094
- );
1095
- var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1096
- message: `Custom flag cannot be one of the inherent flags: ${Object.values(
1097
- InherentFlags
1098
- ).join(", ")}`
1099
- }).refine((val) => !ActionFlag.safeParse(val).success, {
1100
- message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
1101
- }).describe("Custom flag identifier defined by the country config.");
1102
- var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
1103
- var FlagConfig = z14.object({
1104
- id: CustomFlag,
1105
- requiresAction: z14.boolean().describe(
1106
- "Indicates if this flag expects an action to be performed to be cleared."
1107
- ),
1108
- label: TranslationConfig.describe("Human readable label of the flag.")
1109
- }).meta({
1110
- id: "FlagConfig",
1111
- description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1112
- });
1113
- var ActionFlagConfig = z14.object({
1114
- id: Flag,
1115
- operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1116
- conditional: Conditional.optional().describe(
1117
- "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1118
- )
1119
- }).meta({
1120
- id: "ActionFlagConfig",
1121
- description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1122
- });
1171
+ var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
1123
1172
 
1124
1173
  // ../commons/src/events/EventMetadata.ts
1125
- var EventStatus = z15.enum([
1126
- "CREATED",
1127
- "NOTIFIED",
1128
- "DECLARED",
1129
- "REGISTERED",
1130
- "ARCHIVED"
1131
- ]);
1132
- var ZodDate = z15.iso.date();
1133
- var ZodDateTime = z15.string().datetime();
1134
- var ActionCreationMetadata = z15.object({
1135
- createdAt: z15.iso.datetime().describe("The timestamp when the action request was created."),
1136
- createdBy: z15.string().describe("ID of the user who created the action request."),
1174
+ var ZodDate = z16.iso.date();
1175
+ var ZodDateTime = z16.string().datetime();
1176
+ var ActionCreationMetadata = z16.object({
1177
+ createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
1178
+ createdBy: z16.string().describe("ID of the user who created the action request."),
1137
1179
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1138
1180
  createdAtLocation: UUID.nullish().describe(
1139
1181
  "Location of the user who created the action request."
1140
1182
  ),
1141
- createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1142
- acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
1143
- createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
1183
+ createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1184
+ acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1185
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1144
1186
  });
1145
1187
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1146
- registrationNumber: z15.string().describe(
1188
+ registrationNumber: z16.string().describe(
1147
1189
  "Registration number of the event. Always present for accepted registrations."
1148
1190
  )
1149
1191
  });
1150
- var LegalStatuses = z15.object({
1192
+ var LegalStatuses = z16.object({
1151
1193
  [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1152
1194
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1153
1195
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1154
1196
  });
1155
- var EventMetadata = z15.object({
1197
+ var EventMetadata = z16.object({
1156
1198
  id: UUID,
1157
- type: z15.string().describe("The type of event, such as birth, death, or marriage."),
1199
+ type: z16.string().describe("The type of event, such as birth, death, or marriage."),
1158
1200
  status: EventStatus,
1159
1201
  legalStatuses: LegalStatuses.describe(
1160
1202
  "Metadata related to the legal registration of the event, such as who registered it and when."
1161
1203
  ),
1162
- createdAt: z15.iso.datetime().describe("The timestamp when the event was first created and saved."),
1204
+ createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
1163
1205
  dateOfEvent: ZodDate.nullish(),
1164
1206
  placeOfEvent: UUID.nullish(),
1165
- createdBy: z15.string().describe("ID of the user who created the event."),
1166
- createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1167
- updatedByUserRole: z15.string().nullish().describe("Role of the user who last changed the status."),
1207
+ createdBy: z16.string().describe("ID of the user who created the event."),
1208
+ createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1209
+ updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
1168
1210
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1169
1211
  createdAtLocation: UUID.nullish().describe(
1170
1212
  "Location of the user who created the event."
@@ -1172,18 +1214,18 @@ var EventMetadata = z15.object({
1172
1214
  updatedAtLocation: UUID.nullish().describe(
1173
1215
  "Location of the user who last changed the status."
1174
1216
  ),
1175
- updatedAt: z15.iso.datetime().describe(
1217
+ updatedAt: z16.iso.datetime().describe(
1176
1218
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1177
1219
  ),
1178
- assignedTo: z15.string().nullish().describe("ID of the user currently assigned to the event."),
1179
- updatedBy: z15.string().nullish().describe("ID of the user who last changed the status."),
1180
- trackingId: z15.string().describe(
1220
+ assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
1221
+ updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
1222
+ trackingId: z16.string().describe(
1181
1223
  "System-generated tracking ID used by informants or registrars to look up the event."
1182
1224
  ),
1183
- potentialDuplicates: z15.array(PotentialDuplicate).describe(
1225
+ potentialDuplicates: z16.array(PotentialDuplicate).describe(
1184
1226
  "List of event IDs and their tracking IDs that this event could be a duplicate of."
1185
1227
  ),
1186
- flags: z15.array(Flag)
1228
+ flags: z16.array(Flag)
1187
1229
  });
1188
1230
  var EventMetadataKeysArray = [
1189
1231
  "id",
@@ -1204,8 +1246,8 @@ var EventMetadataKeysArray = [
1204
1246
  "legalStatuses",
1205
1247
  "flags"
1206
1248
  ];
1207
- var EventMetadataKeys = z15.enum(EventMetadataKeysArray);
1208
- var EventMetadataDateFieldIdInput = z15.enum([
1249
+ var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
1250
+ var EventMetadataDateFieldIdInput = z16.enum([
1209
1251
  "createdAt",
1210
1252
  "updatedAt",
1211
1253
  "legalStatuses.NOTIFIED.createdAt",
@@ -1215,7 +1257,7 @@ var EventMetadataDateFieldIdInput = z15.enum([
1215
1257
  "legalStatuses.REGISTERED.createdAt",
1216
1258
  "legalStatuses.REGISTERED.acceptedAt"
1217
1259
  ]);
1218
- var EventMetadataDateFieldId = z15.enum([
1260
+ var EventMetadataDateFieldId = z16.enum([
1219
1261
  "event.createdAt",
1220
1262
  "event.updatedAt",
1221
1263
  "event.legalStatuses.NOTIFIED.createdAt",
@@ -1280,13 +1322,6 @@ var Range = import_v4.z.object({
1280
1322
  }).meta({
1281
1323
  id: "Range"
1282
1324
  });
1283
- var ContainsFlags = import_v4.z.object({
1284
- anyOf: import_v4.z.array(Flag).optional(),
1285
- noneOf: import_v4.z.array(Flag).optional(),
1286
- allOf: import_v4.z.array(Flag).optional()
1287
- }).meta({
1288
- id: "ContainsFlags"
1289
- });
1290
1325
  var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
1291
1326
  id: "Within"
1292
1327
  });
@@ -1481,8 +1516,8 @@ var BaseField = import_v43.default.object({
1481
1516
  conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
1482
1517
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
1483
1518
  ),
1484
- secured: import_v43.default.boolean().default(false).optional().describe(
1485
- "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
1519
+ secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
1520
+ "Indicates whether the field is secured, either always (boolean) or conditionally, evaluated against the event (a JSONSchema conditional, e.g. flag('sealed')). Secured fields are not indexed for search and are only visible when explicitly assigned."
1486
1521
  ),
1487
1522
  placeholder: TranslationConfig.optional(),
1488
1523
  validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
@@ -1880,7 +1915,16 @@ var AdministrativeAreaField = BaseField.extend({
1880
1915
  configuration: import_v43.default.object({
1881
1916
  partOf: FieldReference.optional().describe("Parent location"),
1882
1917
  type: AdministrativeAreas,
1883
- allowedLocations: AllowedLocations
1918
+ allowedLocations: AllowedLocations,
1919
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
1920
+ "List every historical name a location has had as a separate, selectable option."
1921
+ ),
1922
+ activeOnly: import_v43.default.boolean().optional().describe(
1923
+ "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
1924
+ ),
1925
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
1926
+ "Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
1927
+ )
1884
1928
  }).describe("Administrative area options")
1885
1929
  }).meta({
1886
1930
  description: "Administrative area input field",
@@ -1891,7 +1935,16 @@ var LocationInput = BaseField.extend({
1891
1935
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1892
1936
  configuration: import_v43.default.object({
1893
1937
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1894
- allowedLocations: AllowedLocations
1938
+ allowedLocations: AllowedLocations,
1939
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
1940
+ "List every historical name a location has had as a separate, selectable option."
1941
+ ),
1942
+ activeOnly: import_v43.default.boolean().optional().describe(
1943
+ "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
1944
+ ),
1945
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
1946
+ "Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
1947
+ )
1895
1948
  }).optional()
1896
1949
  }).meta({
1897
1950
  description: "A field for selecting a location",
@@ -1917,12 +1970,22 @@ var FileUploadWithOptions = BaseField.extend({
1917
1970
  var Facility = BaseField.extend({
1918
1971
  type: import_v43.default.literal(FieldType.FACILITY),
1919
1972
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1920
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1973
+ configuration: import_v43.default.object({
1974
+ allowedLocations: AllowedLocations,
1975
+ listHistoricalNames: import_v43.default.boolean().optional(),
1976
+ activeOnly: import_v43.default.boolean().optional(),
1977
+ anchorToDateOfEvent: import_v43.default.boolean().optional()
1978
+ }).optional()
1921
1979
  }).describe("Input field for a facility");
1922
1980
  var Office = BaseField.extend({
1923
1981
  type: import_v43.default.literal(FieldType.OFFICE),
1924
1982
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1925
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1983
+ configuration: import_v43.default.object({
1984
+ allowedLocations: AllowedLocations,
1985
+ listHistoricalNames: import_v43.default.boolean().optional(),
1986
+ activeOnly: import_v43.default.boolean().optional(),
1987
+ anchorToDateOfEvent: import_v43.default.boolean().optional()
1988
+ }).optional()
1926
1989
  }).describe("Input field for an office");
1927
1990
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
1928
1991
  administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
@@ -1955,7 +2018,16 @@ var Address = BaseField.extend({
1955
2018
  parent: FieldReference.optional()
1956
2019
  })
1957
2020
  ).optional(),
1958
- allowedLocations: AllowedLocations
2021
+ allowedLocations: AllowedLocations,
2022
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
2023
+ "List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
2024
+ ),
2025
+ activeOnly: import_v43.default.boolean().optional().describe(
2026
+ "Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
2027
+ ),
2028
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
2029
+ "Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that. Propagated to the embedded admin-area selectors."
2030
+ )
1959
2031
  }).optional(),
1960
2032
  defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
1961
2033
  }).meta({
@@ -2256,7 +2328,7 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
2256
2328
  ]);
2257
2329
 
2258
2330
  // ../commons/src/application-config.ts
2259
- var SearchCriteria = z20.enum([
2331
+ var SearchCriteria = z21.enum([
2260
2332
  "TRACKING_ID",
2261
2333
  "REGISTRATION_NUMBER",
2262
2334
  "NATIONAL_ID",
@@ -2264,69 +2336,69 @@ var SearchCriteria = z20.enum([
2264
2336
  "PHONE_NUMBER",
2265
2337
  "EMAIL"
2266
2338
  ]);
2267
- var ApplicationConfig = z20.object({
2268
- APPLICATION_NAME: z20.string(),
2269
- COUNTRY_LOGO: z20.object({
2270
- fileName: z20.string(),
2271
- file: z20.string()
2339
+ var ApplicationConfig = z21.object({
2340
+ APPLICATION_NAME: z21.string(),
2341
+ COUNTRY_LOGO: z21.object({
2342
+ fileName: z21.string(),
2343
+ file: z21.string()
2272
2344
  }),
2273
- SYSTEM_IANA_TIMEZONE: z20.string(),
2274
- CURRENCY: z20.object({
2275
- languagesAndCountry: z20.array(z20.string()),
2276
- isoCode: z20.string()
2345
+ SYSTEM_IANA_TIMEZONE: z21.string(),
2346
+ CURRENCY: z21.object({
2347
+ languagesAndCountry: z21.array(z21.string()),
2348
+ isoCode: z21.string()
2277
2349
  }),
2278
- ADMIN_STRUCTURE: z20.array(
2279
- z20.object({
2280
- id: z20.string(),
2350
+ ADMIN_STRUCTURE: z21.array(
2351
+ z21.object({
2352
+ id: z21.string(),
2281
2353
  label: TranslationConfig
2282
2354
  })
2283
2355
  ),
2284
- PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2285
- USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2286
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2356
+ PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
2357
+ USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
2358
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
2287
2359
  SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
2288
- ADDITIONAL_USER_FIELDS: z20.array(FieldConfig).optional().default([])
2360
+ ADDITIONAL_USER_FIELDS: z21.array(FieldConfig).optional().default([])
2289
2361
  });
2290
2362
  var defineApplicationConfig = (config) => {
2291
2363
  return ApplicationConfig.parse(config);
2292
2364
  };
2293
- var BackgroundConfig = z20.object({
2294
- backgroundColor: z20.string().optional(),
2295
- backgroundImage: z20.string().optional(),
2296
- imageFit: z20.string().optional()
2365
+ var BackgroundConfig = z21.object({
2366
+ backgroundColor: z21.string().optional(),
2367
+ backgroundImage: z21.string().optional(),
2368
+ imageFit: z21.string().optional()
2297
2369
  }).refine(
2298
2370
  (data) => !!(data.backgroundColor || data.backgroundImage),
2299
2371
  "backgroundColor and backgroundImage cannot be empty at the same time"
2300
2372
  );
2301
- var LoginConfig = z20.object({
2302
- COUNTRY: z20.string(),
2303
- LANGUAGES: z20.array(z20.string()),
2304
- USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2305
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2306
- PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2373
+ var LoginConfig = z21.object({
2374
+ COUNTRY: z21.string(),
2375
+ LANGUAGES: z21.array(z21.string()),
2376
+ USER_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
2377
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z21.enum(["email", "sms"]),
2378
+ PHONE_NUMBER_PATTERN: z21.string().or(z21.instanceof(RegExp)),
2307
2379
  LOGIN_BACKGROUND: BackgroundConfig,
2308
- SENTRY: z20.string().optional()
2380
+ SENTRY: z21.string().optional()
2309
2381
  });
2310
2382
  var defineLoginConfig = (config) => {
2311
2383
  return LoginConfig.parse(config);
2312
2384
  };
2313
- var ClientConfig = z20.object({
2314
- COUNTRY: z20.string(),
2315
- LANGUAGES: z20.array(z20.string()),
2316
- SENTRY: z20.string().optional(),
2317
- LOGIN_URL: z20.string().optional(),
2385
+ var ClientConfig = z21.object({
2386
+ COUNTRY: z21.string(),
2387
+ LANGUAGES: z21.array(z21.string()),
2388
+ SENTRY: z21.string().optional(),
2389
+ LOGIN_URL: z21.string().optional(),
2318
2390
  REGISTER_BACKGROUND: BackgroundConfig,
2319
- DASHBOARDS: z20.array(
2320
- z20.object({
2321
- id: z20.string(),
2391
+ DASHBOARDS: z21.array(
2392
+ z21.object({
2393
+ id: z21.string(),
2322
2394
  title: TranslationConfig,
2323
- url: z20.string(),
2324
- context: z20.object({
2325
- auth: z20.literal("REQUEST_AUTH_TOKEN")
2395
+ url: z21.string(),
2396
+ context: z21.object({
2397
+ auth: z21.literal("REQUEST_AUTH_TOKEN")
2326
2398
  }).optional()
2327
2399
  })
2328
2400
  ),
2329
- FEATURES: z20.object({ V2_EVENTS: z20.boolean().optional().default(true) }).optional().default({ V2_EVENTS: true })
2401
+ FEATURES: z21.object({ V2_EVENTS: z21.boolean().optional().default(true) }).optional().default({ V2_EVENTS: true })
2330
2402
  });
2331
2403
  var defineClientConfig = (config) => {
2332
2404
  return ClientConfig.parse(config);