@opencrvs/toolkit 2.1.0-rc.c3b24ba → 2.1.0-rc.c500a81

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