@opencrvs/toolkit 2.1.0-rc.5135dc7 → 2.1.0-rc.517ffcd

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 (52) hide show
  1. package/build.sh +3 -0
  2. package/create-countryconfig/index.js +114 -66
  3. package/create-countryconfig/node_modules/.bin/degit +21 -0
  4. package/create-countryconfig/package.json +4 -1
  5. package/dist/application-config/index.js +242 -207
  6. package/dist/cli.js +556 -81
  7. package/dist/commons/api/router.d.ts +407 -50
  8. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  9. package/dist/commons/conditionals/validate.d.ts +6 -2
  10. package/dist/commons/events/ActionDocument.d.ts +4 -4
  11. package/dist/commons/events/ActionInput.d.ts +4 -4
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
  13. package/dist/commons/events/EventDocument.d.ts +470 -2
  14. package/dist/commons/events/EventMetadata.d.ts +1 -11
  15. package/dist/commons/events/EventStatus.d.ts +19 -0
  16. package/dist/commons/events/FieldConfig.d.ts +18 -0
  17. package/dist/commons/events/FieldTypeMapping.d.ts +15 -15
  18. package/dist/commons/events/locations.d.ts +59 -10
  19. package/dist/commons/events/test.utils.d.ts +8 -4
  20. package/dist/commons/events/utils.d.ts +2 -2
  21. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  22. package/dist/commons/notification/dispatch.d.ts +15 -0
  23. package/dist/commons/notification/index.d.ts +1 -0
  24. package/dist/conditionals/index.js +77 -55
  25. package/dist/environment/questions.d.ts.map +1 -1
  26. package/dist/environment/questions.js +20 -14
  27. package/dist/environment/setup-environment.js +1 -1
  28. package/dist/events/index.js +839 -775
  29. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  30. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  32. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  33. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  34. package/dist/migrations/v2.1/add-recovery-link-notifications.js +530 -0
  35. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  36. package/dist/migrations/v2.1/index.js +469 -0
  37. package/dist/notification/index.js +911 -1359
  38. package/dist/scopes/index.d.ts +71 -1
  39. package/dist/scopes/index.js +77 -55
  40. package/dist/telemetry/index.d.ts +48 -0
  41. package/dist/telemetry/index.d.ts.map +1 -0
  42. package/dist/telemetry/index.js +42 -0
  43. package/dist/templates/charts-values/opencrvs-services/values.yaml +1 -1
  44. package/dist/templates/charts-values/opentelemetry/values.yaml +22 -0
  45. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  46. package/dist/templates/inventory/inventory.template.yml +1 -3
  47. package/opencrvs-toolkit-2.1.0-rc.517ffcd.tgz +0 -0
  48. package/package.json +2 -1
  49. package/tsconfig.tsbuildinfo +1 -1
  50. package/dist/templates/inventory/production.example.yml +0 -77
  51. package/dist/templates/inventory/qa.example.yml +0 -48
  52. package/opencrvs-toolkit-2.1.0-rc.5135dc7.tgz +0 -0
@@ -118,6 +118,7 @@ __export(events_exports, {
118
118
  EnableConditional: () => EnableConditional,
119
119
  EventConfig: () => EventConfig,
120
120
  EventDocument: () => EventDocument,
121
+ EventDocumentOnlyLastAction: () => EventDocumentOnlyLastAction,
121
122
  EventFieldConfigSchema: () => EventFieldConfigSchema,
122
123
  EventFieldId: () => EventFieldId,
123
124
  EventFieldIdInput: () => EventFieldIdInput,
@@ -204,6 +205,7 @@ __export(events_exports, {
204
205
  RequestCorrectionActionInput: () => RequestCorrectionActionInput,
205
206
  SearchQuery: () => SearchQuery,
206
207
  SearchQueryParams: () => SearchQueryParams,
208
+ SeededLocationVersions: () => SeededLocationVersions,
207
209
  SelectDateRangeField: () => SelectDateRangeField,
208
210
  SelectDateRangeOption: () => SelectDateRangeOption,
209
211
  SelectDateRangeValue: () => SelectDateRangeValue,
@@ -349,6 +351,7 @@ __export(events_exports, {
349
351
  getDeclarationPages: () => getDeclarationPages,
350
352
  getEventConfigById: () => getEventConfigById,
351
353
  getEventFlags: () => getEventFlags,
354
+ getEventValidatorContext: () => getEventValidatorContext,
352
355
  getFilePathsFromEvent: () => getFilePathsFromEvent,
353
356
  getLocationHierarchy: () => getLocationHierarchy,
354
357
  getMixedPath: () => getMixedPath,
@@ -422,6 +425,7 @@ __export(events_exports, {
422
425
  isSearchFieldType: () => isSearchFieldType,
423
426
  isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
424
427
  isSelectFieldType: () => isSelectFieldType,
428
+ isSelectableAtAnchor: () => isSelectableAtAnchor,
425
429
  isSignatureFieldType: () => isSignatureFieldType,
426
430
  isTemplateVariable: () => isTemplateVariable,
427
431
  isTextAreaFieldType: () => isTextAreaFieldType,
@@ -432,6 +436,7 @@ __export(events_exports, {
432
436
  isVerificationPage: () => isVerificationPage,
433
437
  isVerificationStatusType: () => isVerificationStatusType,
434
438
  isWriteAction: () => isWriteAction,
439
+ locationVersion: () => locationVersion,
435
440
  mandatoryColumns: () => mandatoryColumns,
436
441
  mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
437
442
  mapFieldTypeToZod: () => mapFieldTypeToZod,
@@ -473,14 +478,14 @@ __export(events_exports, {
473
478
  module.exports = __toCommonJS(events_exports);
474
479
 
475
480
  // ../commons/src/events/AuditLog.ts
476
- var z8 = __toESM(require("zod/v4"));
481
+ var z9 = __toESM(require("zod/v4"));
477
482
 
478
483
  // ../commons/src/authentication.ts
479
484
  var import_jwt_decode = __toESM(require("jwt-decode"));
480
- var z7 = __toESM(require("zod/v4"));
485
+ var z8 = __toESM(require("zod/v4"));
481
486
 
482
487
  // ../commons/src/scopes.ts
483
- var z6 = __toESM(require("zod/v4"));
488
+ var z7 = __toESM(require("zod/v4"));
484
489
  var qs = __toESM(require("qs"));
485
490
 
486
491
  // ../commons/src/uuid.ts
@@ -742,12 +747,22 @@ var ActionFlagConfig = z5.object({
742
747
  description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
743
748
  });
744
749
 
750
+ // ../commons/src/events/EventStatus.ts
751
+ var z6 = __toESM(require("zod/v4"));
752
+ var EventStatus = z6.enum([
753
+ "CREATED",
754
+ "NOTIFIED",
755
+ "DECLARED",
756
+ "REGISTERED",
757
+ "ARCHIVED"
758
+ ]);
759
+
745
760
  // ../commons/src/scopes.ts
746
- var JurisdictionFilter = z6.enum(["administrativeArea", "location", "all"]).describe(
761
+ var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
747
762
  "Filters based on user jurisdiction relative to their office location in hierarchy."
748
763
  );
749
- var UserFilter = z6.enum(["user"]).describe("Filters based on the user. Limits to self.");
750
- var RecordScopeTypeV2 = z6.enum([
764
+ var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
765
+ var RecordScopeTypeV2 = z7.enum([
751
766
  "record.search",
752
767
  "record.create",
753
768
  "record.read",
@@ -765,12 +780,17 @@ var RecordScopeTypeV2 = z6.enum([
765
780
  "record.unassign-others",
766
781
  "record.custom-action"
767
782
  ]);
768
- var PlainScopeType = z6.enum([
783
+ var PlainScopeType = z7.enum([
769
784
  // Misc. system scopes
770
785
  "bypassratelimit",
771
786
  "record.reindex",
772
787
  "user.data-seeding",
773
788
  "integration.create",
789
+ // Reading an integration's audit log. Deliberately separate from
790
+ // 'integration.create' so read-only oversight can be granted on its own, and
791
+ // deliberately option-less: system clients have no office and no
792
+ // administrative area, so jurisdiction options would have nothing to bind to.
793
+ "integration.audit.read",
774
794
  "record.import",
775
795
  "config.update-all",
776
796
  "location.edit",
@@ -785,15 +805,21 @@ var PlainScopeType = z6.enum([
785
805
  "record.confirm-registration",
786
806
  "record.reject-registration"
787
807
  ]);
788
- var scopeByEvent = z6.preprocess(
808
+ var scopeByEvent = z7.preprocess(
789
809
  (val) => val === void 0 ? void 0 : [val].flat(),
790
- z6.array(z6.string()).optional()
810
+ z7.array(z7.string()).optional()
791
811
  ).describe("Event type, e.g. birth, death");
792
- var userRole = z6.preprocess(
812
+ var scopeByStatus = z7.preprocess(
793
813
  (val) => val === void 0 ? void 0 : [val].flat(),
794
- z6.array(z6.string()).optional()
814
+ z7.array(EventStatus).optional()
815
+ ).describe(
816
+ "Restricts the scope to records currently in one of these statuses."
817
+ );
818
+ var userRole = z7.preprocess(
819
+ (val) => val === void 0 ? void 0 : [val].flat(),
820
+ z7.array(z7.string()).optional()
795
821
  ).describe("User role, e.g. admin, field agent");
796
- var scopeOptionsPlaceEvent = z6.object({
822
+ var scopeOptionsPlaceEvent = z7.object({
797
823
  event: scopeByEvent,
798
824
  placeOfEvent: JurisdictionFilter.optional()
799
825
  }).describe("Options applicable to all record scopes.");
@@ -801,7 +827,8 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
801
827
  notifiedIn: JurisdictionFilter.optional(),
802
828
  notifiedBy: UserFilter.optional(),
803
829
  declaredIn: JurisdictionFilter.optional(),
804
- declaredBy: UserFilter.optional()
830
+ declaredBy: UserFilter.optional(),
831
+ status: scopeByStatus
805
832
  }).describe("Options applicable to actions that may take place after DECLARE");
806
833
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
807
834
  registeredIn: JurisdictionFilter.optional(),
@@ -811,31 +838,31 @@ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
811
838
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
812
839
  );
813
840
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
814
- customActionTypes: z6.preprocess(
841
+ customActionTypes: z7.preprocess(
815
842
  (val) => val === void 0 ? void 0 : [val].flat(),
816
- z6.array(z6.string()).optional()
843
+ z7.array(z7.string()).optional()
817
844
  ).describe("Allowed custom action types")
818
845
  });
819
- var AccessLevelOptions = z6.object({
846
+ var AccessLevelOptions = z7.object({
820
847
  accessLevel: JurisdictionFilter.optional()
821
848
  });
822
849
  var AllUserScopeOptions = AccessLevelOptions.extend({
823
850
  role: userRole.optional()
824
851
  });
825
- var WorkqueueOrDashboardOptions = z6.object({
826
- ids: z6.preprocess(
852
+ var WorkqueueOrDashboardOptions = z7.object({
853
+ ids: z7.preprocess(
827
854
  (val) => val === void 0 ? void 0 : [val].flat(),
828
- z6.array(z6.string())
855
+ z7.array(z7.string())
829
856
  ).describe("Must contain a list of workqueue or dashboard ids.")
830
857
  });
831
- var AllScopeOptions = z6.object({
858
+ var AllScopeOptions = z7.object({
832
859
  ...AllRecordScopeOptions.shape,
833
860
  ...AccessLevelOptions.shape,
834
861
  ...AllUserScopeOptions.shape,
835
862
  ...WorkqueueOrDashboardOptions.shape
836
863
  });
837
864
  var ScopeOptionKey = AllScopeOptions.keyof();
838
- var ResolvedScopeOptionsPlaceEvent = z6.object({
865
+ var ResolvedScopeOptionsPlaceEvent = z7.object({
839
866
  event: scopeByEvent,
840
867
  placeOfEvent: UUID.nullish()
841
868
  }).describe(
@@ -843,15 +870,15 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
843
870
  );
844
871
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
845
872
  notifiedIn: UUID.nullish(),
846
- notifiedBy: z6.string().optional(),
873
+ notifiedBy: z7.string().optional(),
847
874
  declaredIn: UUID.nullish(),
848
- declaredBy: z6.string().optional()
875
+ declaredBy: z7.string().optional()
849
876
  }).describe(
850
877
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
851
878
  );
852
879
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
853
880
  registeredIn: UUID.nullish(),
854
- registeredBy: z6.string().optional(),
881
+ registeredBy: z7.string().optional(),
855
882
  flags: ContainsFlags.optional()
856
883
  }).describe(
857
884
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
@@ -877,38 +904,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
877
904
  "record.unassign-others"
878
905
  ]);
879
906
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
880
- templates: z6.preprocess(
907
+ templates: z7.preprocess(
881
908
  (val) => val === void 0 ? void 0 : [val].flat(),
882
- z6.array(z6.string()).optional()
909
+ z7.array(z7.string()).optional()
883
910
  ).describe(
884
911
  "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."
885
912
  )
886
913
  });
887
- var RecordScopeV2 = z6.discriminatedUnion("type", [
888
- z6.object({
914
+ var RecordScopeV2 = z7.discriminatedUnion("type", [
915
+ z7.object({
889
916
  type: ScopesWithPlaceEventOptions,
890
917
  options: scopeOptionsPlaceEvent.optional()
891
918
  }),
892
- z6.object({
919
+ z7.object({
893
920
  type: ScopesWithDeclaredOptions,
894
921
  options: scopeOptionsDeclaredOrNotified.optional()
895
922
  }),
896
- z6.object({
923
+ z7.object({
897
924
  type: ScopesWithFullOptions,
898
925
  options: AllRecordScopeOptions.optional()
899
926
  }),
900
- z6.object({
901
- type: z6.literal("record.custom-action"),
927
+ z7.object({
928
+ type: z7.literal("record.custom-action"),
902
929
  options: CustomActionScopeOptions.optional()
903
930
  }),
904
- z6.object({
905
- type: z6.literal("record.print-certified-copies"),
931
+ z7.object({
932
+ type: z7.literal("record.print-certified-copies"),
906
933
  options: ScopeOptionsPrintCertifiedCopies.optional()
907
934
  })
908
935
  ]).describe(
909
936
  "Scopes used to check user's permission to perform actions on a record."
910
937
  );
911
- var SystemScopeType = z6.enum([
938
+ var SystemScopeType = z7.enum([
912
939
  "organisation.read-locations",
913
940
  "user.read",
914
941
  "user.create",
@@ -922,12 +949,12 @@ var UserScopeType = SystemScopeType.extract([
922
949
  "user.search"
923
950
  ]);
924
951
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
925
- var UserScopeV2 = z6.discriminatedUnion("type", [
926
- z6.object({
952
+ var UserScopeV2 = z7.discriminatedUnion("type", [
953
+ z7.object({
927
954
  type: ScopesWithRoleOption,
928
955
  options: AllUserScopeOptions.optional()
929
956
  }),
930
- z6.object({
957
+ z7.object({
931
958
  type: UserScopeType.extract(["user.read", "user.search"]),
932
959
  options: AccessLevelOptions.optional()
933
960
  })
@@ -947,44 +974,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
947
974
  function isCustomActionScope(scope) {
948
975
  return scope.type === "record.custom-action";
949
976
  }
950
- var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
951
- z6.object({
977
+ var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
978
+ z7.object({
952
979
  type: ScopesWithPlaceEventOptions,
953
980
  options: ResolvedScopeOptionsPlaceEvent.optional()
954
981
  }),
955
- z6.object({
982
+ z7.object({
956
983
  type: ScopesWithDeclaredOptions,
957
984
  options: ResolvedScopeOptionsDeclared.optional()
958
985
  }),
959
- z6.object({
986
+ z7.object({
960
987
  type: ScopesWithFullOptions,
961
988
  options: ResolvedScopeOptionsFull.optional()
962
989
  }),
963
- z6.object({
964
- type: z6.literal("record.print-certified-copies"),
990
+ z7.object({
991
+ type: z7.literal("record.print-certified-copies"),
965
992
  options: ResolvedScopeOptionsFull.extend({
966
- templates: z6.array(z6.string()).optional()
993
+ templates: z7.array(z7.string()).optional()
967
994
  }).optional()
968
995
  })
969
996
  ]).describe("Resolved scope with location/user IDs instead of filters.");
970
- var Scope = z6.discriminatedUnion("type", [
971
- z6.object({ type: PlainScopeType }),
997
+ var Scope = z7.discriminatedUnion("type", [
998
+ z7.object({ type: PlainScopeType }),
972
999
  ...RecordScopeV2.options,
973
1000
  ...UserScopeV2.options,
974
- z6.object({
975
- type: z6.literal("organisation.read-locations"),
1001
+ z7.object({
1002
+ type: z7.literal("organisation.read-locations"),
976
1003
  options: AccessLevelOptions.optional()
977
1004
  }),
978
- z6.object({
979
- type: z6.literal("workqueue"),
1005
+ z7.object({
1006
+ type: z7.literal("workqueue"),
980
1007
  options: WorkqueueOrDashboardOptions
981
1008
  }),
982
- z6.object({
983
- type: z6.literal("dashboard.view"),
1009
+ z7.object({
1010
+ type: z7.literal("dashboard.view"),
984
1011
  options: WorkqueueOrDashboardOptions
985
1012
  })
986
1013
  ]);
987
- var ScopeType = z6.enum([
1014
+ var ScopeType = z7.enum([
988
1015
  ...SystemScopeType.options,
989
1016
  ...RecordScopeTypeV2.options,
990
1017
  ...PlainScopeType.options,
@@ -995,7 +1022,7 @@ var unflattenScope = (input) => {
995
1022
  const { type, ...options } = input;
996
1023
  return { type, options };
997
1024
  };
998
- var EncodedScope = z6.string().brand("EncodedScope");
1025
+ var EncodedScope = z7.string().brand("EncodedScope");
999
1026
  var decodedScopeCache = /* @__PURE__ */ new Map();
1000
1027
  var decodeScope = (encodedScope) => {
1001
1028
  if (decodedScopeCache.has(encodedScope)) {
@@ -1031,51 +1058,51 @@ function getAcceptedScopesByType({
1031
1058
  }
1032
1059
 
1033
1060
  // ../commons/src/authentication.ts
1034
- var TokenUserType = z7.enum(["user", "system"]);
1035
- var TokenWithBearer = z7.string().regex(/^Bearer\s/);
1061
+ var TokenUserType = z8.enum(["user", "system"]);
1062
+ var TokenWithBearer = z8.string().regex(/^Bearer\s/);
1036
1063
 
1037
1064
  // ../commons/src/events/AuditLog.ts
1038
- var AuditLogEntryBase = z8.object({
1039
- id: z8.string(),
1040
- clientId: z8.string(),
1065
+ var AuditLogEntryBase = z9.object({
1066
+ id: z9.string(),
1067
+ clientId: z9.string(),
1041
1068
  clientType: TokenUserType,
1042
- createdAt: z8.string()
1069
+ createdAt: z9.string()
1043
1070
  });
1044
1071
  var EventCreateEntrySchema = AuditLogEntryBase.extend({
1045
- operation: z8.literal("event.create"),
1046
- requestData: z8.object({
1047
- transactionId: z8.string(),
1048
- type: z8.string(),
1049
- createdAtLocation: z8.string().nullable()
1072
+ operation: z9.literal("event.create"),
1073
+ requestData: z9.object({
1074
+ transactionId: z9.string(),
1075
+ type: z9.string(),
1076
+ createdAtLocation: z9.string().nullable()
1050
1077
  }),
1051
- responseSummary: z8.object({
1052
- eventId: z8.string(),
1053
- trackingId: z8.string()
1078
+ responseSummary: z9.object({
1079
+ eventId: z9.string(),
1080
+ trackingId: z9.string()
1054
1081
  })
1055
1082
  });
1056
1083
  var EventGetEntrySchema = AuditLogEntryBase.extend({
1057
- operation: z8.literal("event.get"),
1058
- requestData: z8.object({ eventId: z8.string() }),
1059
- responseSummary: z8.object({
1060
- eventType: z8.string(),
1061
- trackingId: z8.string()
1084
+ operation: z9.literal("event.get"),
1085
+ requestData: z9.object({ eventId: z9.string() }),
1086
+ responseSummary: z9.object({
1087
+ eventType: z9.string(),
1088
+ trackingId: z9.string()
1062
1089
  })
1063
1090
  });
1064
1091
  var EventSearchEntrySchema = AuditLogEntryBase.extend({
1065
- operation: z8.literal("event.search"),
1066
- clientType: z8.literal("system"),
1067
- requestData: z8.object({
1068
- query: z8.record(z8.string(), z8.unknown()).nullable(),
1069
- limit: z8.number().nullable(),
1070
- offset: z8.number().nullable()
1092
+ operation: z9.literal("event.search"),
1093
+ clientType: z9.literal("system"),
1094
+ requestData: z9.object({
1095
+ query: z9.record(z9.string(), z9.unknown()).nullable(),
1096
+ limit: z9.number().nullable(),
1097
+ offset: z9.number().nullable()
1071
1098
  }),
1072
- responseSummary: z8.object({
1073
- total: z8.number(),
1074
- eventIds: z8.array(z8.string())
1099
+ responseSummary: z9.object({
1100
+ total: z9.number(),
1101
+ eventIds: z9.array(z9.string())
1075
1102
  })
1076
1103
  });
1077
1104
  var EventActionEntrySchema = AuditLogEntryBase.extend({
1078
- operation: z8.enum([
1105
+ operation: z9.enum([
1079
1106
  "event.actions.notify.request",
1080
1107
  "event.actions.declare.request",
1081
1108
  "event.actions.register.request",
@@ -1095,159 +1122,159 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
1095
1122
  "event.actions.mark_as_duplicate.request",
1096
1123
  "event.actions.mark_as_not_duplicate.request"
1097
1124
  ]),
1098
- requestData: z8.object({
1099
- eventId: z8.string(),
1100
- actionType: z8.string(),
1101
- eventType: z8.string(),
1102
- trackingId: z8.string(),
1103
- transactionId: z8.string()
1125
+ requestData: z9.object({
1126
+ eventId: z9.string(),
1127
+ actionType: z9.string(),
1128
+ eventType: z9.string(),
1129
+ trackingId: z9.string(),
1130
+ transactionId: z9.string()
1104
1131
  })
1105
1132
  });
1106
1133
  var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
1107
- operation: z8.literal("event.actions.custom.request"),
1108
- requestData: z8.object({
1109
- eventId: z8.string(),
1110
- actionType: z8.literal(ActionType.CUSTOM),
1111
- customAction: z8.string(),
1112
- eventType: z8.string(),
1113
- trackingId: z8.string(),
1114
- transactionId: z8.string()
1134
+ operation: z9.literal("event.actions.custom.request"),
1135
+ requestData: z9.object({
1136
+ eventId: z9.string(),
1137
+ actionType: z9.literal(ActionType.CUSTOM),
1138
+ customAction: z9.string(),
1139
+ eventType: z9.string(),
1140
+ trackingId: z9.string(),
1141
+ transactionId: z9.string()
1115
1142
  })
1116
1143
  });
1117
1144
  var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
1118
- operation: z8.literal("integrations.create"),
1119
- requestData: z8.object({ name: z8.string(), scopes: z8.array(z8.string()) }),
1120
- responseSummary: z8.object({ clientId: z8.string() })
1145
+ operation: z9.literal("integrations.create"),
1146
+ requestData: z9.object({ name: z9.string(), scopes: z9.array(z9.string()) }),
1147
+ responseSummary: z9.object({ clientId: z9.string() })
1121
1148
  });
1122
1149
  var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
1123
- operation: z8.literal("integrations.refreshToken"),
1124
- requestData: z8.object({ clientId: z8.string() }),
1125
- responseSummary: z8.object({ clientId: z8.string() })
1150
+ operation: z9.literal("integrations.refreshToken"),
1151
+ requestData: z9.object({ clientId: z9.string() }),
1152
+ responseSummary: z9.object({ clientId: z9.string() })
1126
1153
  });
1127
1154
  var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
1128
- operation: z8.literal("integrations.deactivate"),
1129
- requestData: z8.object({ id: z8.string() }),
1130
- responseSummary: z8.object({ id: z8.string(), status: z8.string() })
1155
+ operation: z9.literal("integrations.deactivate"),
1156
+ requestData: z9.object({ id: z9.string() }),
1157
+ responseSummary: z9.object({ id: z9.string(), status: z9.string() })
1131
1158
  });
1132
1159
  var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
1133
- operation: z8.literal("integrations.activate"),
1134
- requestData: z8.object({ id: z8.string() }),
1135
- responseSummary: z8.object({ id: z8.string(), status: z8.string() })
1160
+ operation: z9.literal("integrations.activate"),
1161
+ requestData: z9.object({ id: z9.string() }),
1162
+ responseSummary: z9.object({ id: z9.string(), status: z9.string() })
1136
1163
  });
1137
1164
  var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
1138
- operation: z8.literal("integrations.delete"),
1139
- requestData: z8.object({ id: z8.string() }),
1140
- responseSummary: z8.object({ id: z8.string(), name: z8.string() })
1165
+ operation: z9.literal("integrations.delete"),
1166
+ requestData: z9.object({ id: z9.string() }),
1167
+ responseSummary: z9.object({ id: z9.string(), name: z9.string() })
1141
1168
  });
1142
1169
  var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
1143
- operation: z8.literal("integrations.refreshSecret"),
1144
- requestData: z8.object({ id: z8.string() }),
1145
- responseSummary: z8.object({ clientId: z8.string() })
1170
+ operation: z9.literal("integrations.refreshSecret"),
1171
+ requestData: z9.object({ id: z9.string() }),
1172
+ responseSummary: z9.object({ clientId: z9.string() })
1146
1173
  });
1147
1174
  var createdVersionFields = {
1148
- id: z8.string(),
1149
- versionId: z8.string(),
1150
- name: z8.string(),
1151
- externalId: z8.string().nullish(),
1152
- effectiveFrom: z8.string(),
1153
- status: z8.string()
1175
+ id: z9.string(),
1176
+ versionId: z9.string(),
1177
+ name: z9.string(),
1178
+ externalId: z9.string().nullish(),
1179
+ effectiveFrom: z9.string(),
1180
+ status: z9.string()
1154
1181
  };
1155
1182
  var LocationCreateEntrySchema = AuditLogEntryBase.extend({
1156
- operation: z8.literal("locations.create"),
1157
- requestData: z8.object({
1183
+ operation: z9.literal("locations.create"),
1184
+ requestData: z9.object({
1158
1185
  ...createdVersionFields,
1159
- administrativeAreaId: z8.string().nullish(),
1160
- locationType: z8.string().nullish()
1186
+ administrativeAreaId: z9.string().nullish(),
1187
+ locationType: z9.string().nullish()
1161
1188
  })
1162
1189
  });
1163
1190
  var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
1164
- operation: z8.literal("administrativeAreas.create"),
1165
- requestData: z8.object({
1191
+ operation: z9.literal("administrativeAreas.create"),
1192
+ requestData: z9.object({
1166
1193
  ...createdVersionFields,
1167
- parentId: z8.string().nullish()
1194
+ parentId: z9.string().nullish()
1168
1195
  })
1169
1196
  });
1170
- var ChangedStringField = z8.object({ from: z8.string(), to: z8.string() });
1171
- var ChangedNullableStringField = z8.object({
1172
- from: z8.string().nullable(),
1173
- to: z8.string().nullable()
1174
- });
1175
- var updatedVersionRequestData = z8.object({
1176
- id: z8.string(),
1177
- versionId: z8.string(),
1178
- name: z8.string(),
1179
- externalId: z8.string().nullish(),
1180
- status: z8.string(),
1181
- effectiveFrom: z8.string(),
1182
- lastVersionId: z8.string()
1183
- });
1184
- var updatedVersionResponseSummary = z8.object({
1185
- previousVersionId: z8.string(),
1186
- versionId: z8.string(),
1187
- changed: z8.object({
1197
+ var ChangedStringField = z9.object({ from: z9.string(), to: z9.string() });
1198
+ var ChangedNullableStringField = z9.object({
1199
+ from: z9.string().nullable(),
1200
+ to: z9.string().nullable()
1201
+ });
1202
+ var updatedVersionRequestData = z9.object({
1203
+ id: z9.string(),
1204
+ versionId: z9.string(),
1205
+ name: z9.string(),
1206
+ externalId: z9.string().nullish(),
1207
+ status: z9.string(),
1208
+ effectiveFrom: z9.string(),
1209
+ lastVersionId: z9.string()
1210
+ });
1211
+ var updatedVersionResponseSummary = z9.object({
1212
+ previousVersionId: z9.string(),
1213
+ versionId: z9.string(),
1214
+ changed: z9.object({
1188
1215
  name: ChangedStringField.optional(),
1189
1216
  externalId: ChangedNullableStringField.optional(),
1190
1217
  status: ChangedStringField.optional()
1191
1218
  })
1192
1219
  });
1193
1220
  var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
1194
- operation: z8.literal("locations.update"),
1221
+ operation: z9.literal("locations.update"),
1195
1222
  requestData: updatedVersionRequestData,
1196
1223
  responseSummary: updatedVersionResponseSummary
1197
1224
  });
1198
1225
  var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
1199
- operation: z8.literal("administrativeAreas.update"),
1226
+ operation: z9.literal("administrativeAreas.update"),
1200
1227
  requestData: updatedVersionRequestData,
1201
1228
  responseSummary: updatedVersionResponseSummary
1202
1229
  });
1203
- var withdrawVersionRequestData = z8.object({
1204
- id: z8.string(),
1205
- versionId: z8.string()
1230
+ var withdrawVersionRequestData = z9.object({
1231
+ id: z9.string(),
1232
+ versionId: z9.string()
1206
1233
  });
1207
- var withdrawVersionResponseSummary = z8.object({
1208
- effectiveFrom: z8.string(),
1209
- name: z8.string(),
1210
- externalId: z8.string().nullish(),
1211
- status: z8.string()
1234
+ var withdrawVersionResponseSummary = z9.object({
1235
+ effectiveFrom: z9.string(),
1236
+ name: z9.string(),
1237
+ externalId: z9.string().nullish(),
1238
+ status: z9.string()
1212
1239
  });
1213
1240
  var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
1214
- operation: z8.literal("locations.withdrawVersion"),
1241
+ operation: z9.literal("locations.withdrawVersion"),
1215
1242
  requestData: withdrawVersionRequestData,
1216
1243
  responseSummary: withdrawVersionResponseSummary
1217
1244
  });
1218
1245
  var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
1219
- operation: z8.literal("administrativeAreas.withdrawVersion"),
1246
+ operation: z9.literal("administrativeAreas.withdrawVersion"),
1220
1247
  requestData: withdrawVersionRequestData,
1221
1248
  responseSummary: withdrawVersionResponseSummary
1222
1249
  });
1223
1250
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
1224
- operation: z8.literal("attachments.upload"),
1225
- requestData: z8.object({
1226
- transactionId: z8.string(),
1227
- path: z8.string().nullable()
1251
+ operation: z9.literal("attachments.upload"),
1252
+ requestData: z9.object({
1253
+ transactionId: z9.string(),
1254
+ path: z9.string().nullable()
1228
1255
  }),
1229
- responseSummary: z8.object({ fileUrl: z8.string() })
1256
+ responseSummary: z9.object({ fileUrl: z9.string() })
1230
1257
  });
1231
- var subjectOnly = z8.object({ subjectId: z8.string() });
1232
- var subjectWithReason = z8.object({
1233
- subjectId: z8.string(),
1234
- reason: z8.string(),
1235
- comment: z8.string().optional()
1258
+ var subjectOnly = z9.object({ subjectId: z9.string() });
1259
+ var subjectWithReason = z9.object({
1260
+ subjectId: z9.string(),
1261
+ reason: z9.string(),
1262
+ comment: z9.string().optional()
1236
1263
  });
1237
1264
  var UserCreateEntrySchema = AuditLogEntryBase.extend({
1238
- operation: z8.literal("user.create_user"),
1239
- requestData: z8.object({
1240
- subjectId: z8.string(),
1241
- role: z8.string(),
1242
- primaryOfficeId: z8.string()
1265
+ operation: z9.literal("user.create_user"),
1266
+ requestData: z9.object({
1267
+ subjectId: z9.string(),
1268
+ role: z9.string(),
1269
+ primaryOfficeId: z9.string()
1243
1270
  })
1244
1271
  });
1245
1272
  var UserReasonEntrySchema = AuditLogEntryBase.extend({
1246
- operation: z8.enum(["user.deactivate", "user.reactivate"]),
1273
+ operation: z9.enum(["user.deactivate", "user.reactivate"]),
1247
1274
  requestData: subjectWithReason
1248
1275
  });
1249
1276
  var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
1250
- operation: z8.enum([
1277
+ operation: z9.enum([
1251
1278
  "user.edit_user",
1252
1279
  "user.logged_in",
1253
1280
  "user.logged_out",
@@ -1261,14 +1288,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
1261
1288
  requestData: subjectOnly
1262
1289
  });
1263
1290
  var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
1264
- operation: z8.literal("user.email_address_changed"),
1291
+ operation: z9.literal("user.email_address_changed"),
1265
1292
  requestData: subjectOnly,
1266
- responseSummary: z8.object({ email: z8.string() })
1293
+ responseSummary: z9.object({ email: z9.string() })
1267
1294
  });
1268
1295
  var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
1269
- operation: z8.literal("user.phone_number_changed"),
1296
+ operation: z9.literal("user.phone_number_changed"),
1270
1297
  requestData: subjectOnly,
1271
- responseSummary: z8.object({ phoneNumber: z8.string() })
1298
+ responseSummary: z9.object({ phoneNumber: z9.string() })
1272
1299
  });
1273
1300
  var userBaseOmit = {
1274
1301
  id: true,
@@ -1276,14 +1303,14 @@ var userBaseOmit = {
1276
1303
  clientType: true,
1277
1304
  createdAt: true
1278
1305
  };
1279
- var UserAuditRecordInput = z8.discriminatedUnion("operation", [
1306
+ var UserAuditRecordInput = z9.discriminatedUnion("operation", [
1280
1307
  UserCreateEntrySchema.omit(userBaseOmit),
1281
1308
  UserReasonEntrySchema.omit(userBaseOmit),
1282
1309
  UserSubjectOnlyEntrySchema.omit(userBaseOmit),
1283
1310
  UserEmailChangedEntrySchema.omit(userBaseOmit),
1284
1311
  UserPhoneChangedEntrySchema.omit(userBaseOmit)
1285
1312
  ]);
1286
- var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
1313
+ var AuditLogEntrySchema = z9.discriminatedUnion("operation", [
1287
1314
  EventCreateEntrySchema,
1288
1315
  EventGetEntrySchema,
1289
1316
  EventSearchEntrySchema,
@@ -1314,13 +1341,13 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
1314
1341
  var CHILD_ONBOARDING_EVENT = "child-onboarding";
1315
1342
 
1316
1343
  // ../commons/src/events/ActionConfig.ts
1317
- var z24 = __toESM(require("zod/v4"));
1344
+ var z25 = __toESM(require("zod/v4"));
1318
1345
 
1319
1346
  // ../commons/src/events/FieldConfig.ts
1320
1347
  var import_v43 = __toESM(require("zod/v4"));
1321
1348
 
1322
1349
  // ../commons/src/events/FieldType.ts
1323
- var z9 = __toESM(require("zod/v4"));
1350
+ var z10 = __toESM(require("zod/v4"));
1324
1351
  var FieldType = {
1325
1352
  NAME: "NAME",
1326
1353
  PHONE: "PHONE",
@@ -1384,7 +1411,7 @@ var FieldType = {
1384
1411
  */
1385
1412
  _EXPERIMENTAL_CUSTOM: "CUSTOM"
1386
1413
  };
1387
- var FileFieldType = z9.enum([
1414
+ var FileFieldType = z10.enum([
1388
1415
  FieldType.FILE,
1389
1416
  FieldType.FILE_WITH_OPTIONS,
1390
1417
  FieldType.SIGNATURE
@@ -1420,22 +1447,22 @@ var HiddenFieldTypes = [
1420
1447
  ];
1421
1448
 
1422
1449
  // ../commons/src/events/FieldValue.ts
1423
- var z13 = __toESM(require("zod/v4"));
1450
+ var z14 = __toESM(require("zod/v4"));
1424
1451
 
1425
1452
  // ../commons/src/documents.ts
1426
- var z10 = __toESM(require("zod/v4"));
1427
- var FullDocumentUrl = z10.string().brand("FullDocumentUrl").describe(
1453
+ var z11 = __toESM(require("zod/v4"));
1454
+ var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
1428
1455
  "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
1429
1456
  );
1430
- var FullDocumentPath = z10.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
1457
+ var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
1431
1458
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
1432
1459
  );
1433
- var DocumentPath = z10.string().brand("DocumentPath").describe(
1460
+ var DocumentPath = z11.string().brand("DocumentPath").describe(
1434
1461
  "A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
1435
1462
  );
1436
1463
 
1437
1464
  // ../commons/src/events/CompositeFieldValue.ts
1438
- var z11 = __toESM(require("zod/v4"));
1465
+ var z12 = __toESM(require("zod/v4"));
1439
1466
  var GeographicalArea = {
1440
1467
  URBAN: "URBAN",
1441
1468
  RURAL: "RURAL"
@@ -1444,94 +1471,94 @@ var AddressType = {
1444
1471
  DOMESTIC: "DOMESTIC",
1445
1472
  INTERNATIONAL: "INTERNATIONAL"
1446
1473
  };
1447
- var FileFieldValue = z11.object({
1474
+ var FileFieldValue = z12.object({
1448
1475
  path: DocumentPath,
1449
- originalFilename: z11.string(),
1450
- type: z11.string()
1451
- });
1452
- var NameFieldValue = z11.object({
1453
- firstname: z11.string(),
1454
- surname: z11.string(),
1455
- middlename: z11.string().optional()
1456
- });
1457
- var NameFieldUpdateValue = z11.object({
1458
- firstname: z11.string().nullish(),
1459
- surname: z11.string().nullish(),
1460
- middlename: z11.string().nullish()
1461
- }).or(z11.null()).or(z11.undefined());
1462
- var StreetLevelDetailsValue = z11.record(z11.string(), z11.string()).optional();
1463
- var StreetLevelDetailsUpdateValue = z11.record(z11.string(), z11.string().nullable()).nullish();
1464
- var BaseAddressFieldValue = z11.object({
1465
- country: z11.string(),
1476
+ originalFilename: z12.string(),
1477
+ type: z12.string()
1478
+ });
1479
+ var NameFieldValue = z12.object({
1480
+ firstname: z12.string(),
1481
+ surname: z12.string(),
1482
+ middlename: z12.string().optional()
1483
+ });
1484
+ var NameFieldUpdateValue = z12.object({
1485
+ firstname: z12.string().nullish(),
1486
+ surname: z12.string().nullish(),
1487
+ middlename: z12.string().nullish()
1488
+ }).or(z12.null()).or(z12.undefined());
1489
+ var StreetLevelDetailsValue = z12.record(z12.string(), z12.string()).optional();
1490
+ var StreetLevelDetailsUpdateValue = z12.record(z12.string(), z12.string().nullable()).nullish();
1491
+ var BaseAddressFieldValue = z12.object({
1492
+ country: z12.string(),
1466
1493
  streetLevelDetails: StreetLevelDetailsValue
1467
1494
  });
1468
- var BaseAddressFieldUpdateValue = z11.object({
1469
- country: z11.string().nullish(),
1495
+ var BaseAddressFieldUpdateValue = z12.object({
1496
+ country: z12.string().nullish(),
1470
1497
  streetLevelDetails: StreetLevelDetailsUpdateValue
1471
1498
  });
1472
1499
  var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
1473
- addressType: z11.literal(AddressType.DOMESTIC),
1474
- administrativeArea: z11.string().uuid()
1500
+ addressType: z12.literal(AddressType.DOMESTIC),
1501
+ administrativeArea: z12.string().uuid()
1475
1502
  });
1476
1503
  var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
1477
- addressType: z11.literal(AddressType.INTERNATIONAL)
1504
+ addressType: z12.literal(AddressType.INTERNATIONAL)
1478
1505
  });
1479
- var AddressFieldValue = z11.discriminatedUnion("addressType", [
1506
+ var AddressFieldValue = z12.discriminatedUnion("addressType", [
1480
1507
  DomesticAddressFieldValue,
1481
1508
  InternationalAddressFieldValue
1482
1509
  ]);
1483
1510
  var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
1484
- addressType: z11.literal(AddressType.DOMESTIC),
1485
- administrativeArea: z11.string().uuid().nullish()
1511
+ addressType: z12.literal(AddressType.DOMESTIC),
1512
+ administrativeArea: z12.string().uuid().nullish()
1486
1513
  /* Leaf level admin structure */
1487
1514
  });
1488
1515
  var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
1489
1516
  {
1490
- addressType: z11.literal(AddressType.INTERNATIONAL)
1517
+ addressType: z12.literal(AddressType.INTERNATIONAL)
1491
1518
  }
1492
1519
  );
1493
- var AddressFieldUpdateValue = z11.discriminatedUnion("addressType", [
1520
+ var AddressFieldUpdateValue = z12.discriminatedUnion("addressType", [
1494
1521
  DomesticAddressUpdateFieldValue,
1495
1522
  InternationalAddressUpdateFieldValue
1496
1523
  ]).nullish();
1497
- var FileFieldValueWithOption = z11.object({
1524
+ var FileFieldValueWithOption = z12.object({
1498
1525
  path: DocumentPath,
1499
- originalFilename: z11.string(),
1500
- type: z11.string(),
1501
- option: z11.string()
1502
- });
1503
- var FileFieldWithOptionValue = z11.array(FileFieldValueWithOption);
1504
- var HttpFieldValue = z11.object({
1505
- loading: z11.boolean(),
1506
- error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
1507
- data: z11.any()
1508
- });
1509
- var HttpFieldUpdateValue = z11.object({
1510
- loading: z11.boolean().nullish(),
1511
- error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
1512
- data: z11.any().nullish()
1513
- }).or(z11.null()).or(z11.undefined());
1514
- var QueryParamReaderFieldValue = z11.object({
1515
- data: z11.record(z11.string(), z11.string()),
1516
- updatedAt: z11.iso.datetime()
1526
+ originalFilename: z12.string(),
1527
+ type: z12.string(),
1528
+ option: z12.string()
1529
+ });
1530
+ var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
1531
+ var HttpFieldValue = z12.object({
1532
+ loading: z12.boolean(),
1533
+ error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
1534
+ data: z12.any()
1535
+ });
1536
+ var HttpFieldUpdateValue = z12.object({
1537
+ loading: z12.boolean().nullish(),
1538
+ error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
1539
+ data: z12.any().nullish()
1540
+ }).or(z12.null()).or(z12.undefined());
1541
+ var QueryParamReaderFieldValue = z12.object({
1542
+ data: z12.record(z12.string(), z12.string()),
1543
+ updatedAt: z12.iso.datetime()
1517
1544
  }).nullish();
1518
- var QueryParamReaderFieldUpdateValue = z11.object({
1519
- data: z11.record(z11.string(), z11.string())
1545
+ var QueryParamReaderFieldUpdateValue = z12.object({
1546
+ data: z12.record(z12.string(), z12.string())
1520
1547
  });
1521
- var ReadDataValue = z11.object({
1522
- data: z11.any()
1548
+ var ReadDataValue = z12.object({
1549
+ data: z12.any()
1523
1550
  });
1524
1551
  var QrReaderFieldValue = ReadDataValue;
1525
1552
  var IdReaderFieldValue = ReadDataValue;
1526
- var NumberWithUnitFieldValue = z11.object({
1527
- numericValue: z11.number(),
1528
- unit: z11.string()
1553
+ var NumberWithUnitFieldValue = z12.object({
1554
+ numericValue: z12.number(),
1555
+ unit: z12.string()
1529
1556
  });
1530
- var NumberWithUnitFieldUpdateValue = z11.object({
1531
- numericValue: z11.number().optional(),
1532
- unit: z11.string().optional()
1557
+ var NumberWithUnitFieldUpdateValue = z12.object({
1558
+ numericValue: z12.number().optional(),
1559
+ unit: z12.string().optional()
1533
1560
  });
1534
- var CustomFieldValue = z11.unknown().brand("CustomFieldValue");
1561
+ var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
1535
1562
 
1536
1563
  // ../commons/src/events/PlainDate.ts
1537
1564
  var import_zod = require("zod");
@@ -1545,46 +1572,46 @@ function plainDateToLocalDate(date) {
1545
1572
  }
1546
1573
 
1547
1574
  // ../commons/src/events/FieldValue.ts
1548
- var TextValue = z13.string();
1549
- var HiddenFieldValue = z13.string();
1550
- var NonEmptyTextValue = z13.string().trim().min(1);
1551
- var DateValue = z13.iso.date().describe("Date in the format YYYY-MM-DD");
1552
- var AgeValue = z13.object({
1553
- age: z13.number(),
1554
- asOfDateRef: z13.string()
1575
+ var TextValue = z14.string();
1576
+ var HiddenFieldValue = z14.string();
1577
+ var NonEmptyTextValue = z14.string().trim().min(1);
1578
+ var DateValue = z14.iso.date().describe("Date in the format YYYY-MM-DD");
1579
+ var AgeValue = z14.object({
1580
+ age: z14.number(),
1581
+ asOfDateRef: z14.string()
1555
1582
  });
1556
1583
  var AgeUpdateValue = AgeValue.optional().nullable();
1557
- var AutocompleteValue = z13.object({
1558
- label: z13.string(),
1559
- value: z13.string()
1584
+ var AutocompleteValue = z14.object({
1585
+ label: z14.string(),
1586
+ value: z14.string()
1560
1587
  });
1561
1588
  var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
1562
- var TimeValue = z13.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
1563
- var DatetimeValue = z13.iso.datetime();
1564
- var SelectDateRangeValue = z13.enum([
1589
+ var TimeValue = z14.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
1590
+ var DatetimeValue = z14.iso.datetime();
1591
+ var SelectDateRangeValue = z14.enum([
1565
1592
  "last7Days",
1566
1593
  "last30Days",
1567
1594
  "last90Days",
1568
1595
  "last365Days"
1569
1596
  ]);
1570
- var DateRangeFieldValue = z13.object({
1597
+ var DateRangeFieldValue = z14.object({
1571
1598
  start: PlainDate,
1572
1599
  end: PlainDate
1573
1600
  }).or(PlainDate).describe(
1574
1601
  "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
1575
1602
  );
1576
- var EmailValue = z13.email();
1577
- var CheckboxFieldValue = z13.boolean();
1578
- var NumberFieldValue = z13.number();
1603
+ var EmailValue = z14.email();
1604
+ var CheckboxFieldValue = z14.boolean();
1605
+ var NumberFieldValue = z14.number();
1579
1606
  var SignatureFieldValue = FileFieldValue;
1580
- var ButtonFieldValue = z13.number();
1581
- var VerificationStatusValue = z13.enum([
1607
+ var ButtonFieldValue = z14.number();
1608
+ var VerificationStatusValue = z14.enum([
1582
1609
  "verified",
1583
1610
  "authenticated",
1584
1611
  "failed",
1585
1612
  "pending"
1586
1613
  ]);
1587
- var LeafFieldValues = z13.union([
1614
+ var LeafFieldValues = z14.union([
1588
1615
  AddressFieldValue,
1589
1616
  TextValue,
1590
1617
  PlainDate,
@@ -1610,11 +1637,11 @@ var LeafFieldValues = z13.union([
1610
1637
  AutocompleteValue,
1611
1638
  AutocompleteUpdateValue
1612
1639
  ]);
1613
- var FieldGroupValue = z13.record(z13.string(), LeafFieldValues);
1614
- var DataFieldValue = z13.object({
1615
- data: z13.record(z13.string(), LeafFieldValues)
1640
+ var FieldGroupValue = z14.record(z14.string(), LeafFieldValues);
1641
+ var DataFieldValue = z14.object({
1642
+ data: z14.record(z14.string(), LeafFieldValues)
1616
1643
  }).nullish();
1617
- var FieldValue = z13.union([
1644
+ var FieldValue = z14.union([
1618
1645
  LeafFieldValues,
1619
1646
  DataFieldValue,
1620
1647
  FieldGroupValue
@@ -1648,7 +1675,7 @@ function safeUnion(schemas) {
1648
1675
  const sortedSchemas = [...schemas].sort(
1649
1676
  (a, b) => schemaPriority(a) - schemaPriority(b)
1650
1677
  );
1651
- return z13.any().superRefine((val, ctx) => {
1678
+ return z14.any().superRefine((val, ctx) => {
1652
1679
  for (const schema of sortedSchemas) {
1653
1680
  if (schema.safeParse(val).success) {
1654
1681
  return;
@@ -1687,9 +1714,9 @@ var FieldUpdateValue = safeUnion([
1687
1714
  ]);
1688
1715
 
1689
1716
  // ../commons/src/events/serializers/user/serializer.ts
1690
- var z14 = __toESM(require("zod/v4"));
1691
- var SerializedUserField = z14.object({
1692
- $userField: z14.enum([
1717
+ var z15 = __toESM(require("zod/v4"));
1718
+ var SerializedUserField = z15.object({
1719
+ $userField: z15.enum([
1693
1720
  "id",
1694
1721
  "name",
1695
1722
  "role",
@@ -1703,7 +1730,7 @@ var SerializedUserField = z14.object({
1703
1730
  "primaryOfficeId",
1704
1731
  "administrativeAreaId"
1705
1732
  ]),
1706
- $location: z14.string().optional()
1733
+ $location: z15.string().optional()
1707
1734
  });
1708
1735
  function userSerializer(userField) {
1709
1736
  return {
@@ -1726,25 +1753,25 @@ function userSerializer(userField) {
1726
1753
  var import_v4 = require("zod/v4");
1727
1754
 
1728
1755
  // ../commons/src/events/EventMetadata.ts
1729
- var z16 = __toESM(require("zod/v4"));
1756
+ var z17 = __toESM(require("zod/v4"));
1730
1757
 
1731
1758
  // ../commons/src/events/ActionDocument.ts
1732
- var z15 = __toESM(require("zod/v4"));
1733
- var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
1759
+ var z16 = __toESM(require("zod/v4"));
1760
+ var ActionUpdate = z16.record(z16.string(), FieldUpdateValue).describe(
1734
1761
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
1735
1762
  );
1736
- var EventState = z15.record(z15.string(), FieldValue).describe(
1763
+ var EventState = z16.record(z16.string(), FieldValue).describe(
1737
1764
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
1738
1765
  );
1739
- var ActionBase = z15.object({
1766
+ var ActionBase = z16.object({
1740
1767
  id: UUID.describe("Unique identifier of the action."),
1741
- transactionId: z15.string().describe("Unique identifier of the transaction."),
1768
+ transactionId: z16.string().describe("Unique identifier of the transaction."),
1742
1769
  createdByUserType: TokenUserType.describe(
1743
1770
  "Indicates whether the action was created by a human-user or by a system-user."
1744
1771
  ),
1745
- createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
1746
- createdBy: z15.string().describe("Identifier of the user who created the action."),
1747
- createdByRole: z15.string().optional().describe("Role of the user who created the action."),
1772
+ createdAt: z16.string().datetime().describe("Timestamp indicating when the action was created."),
1773
+ createdBy: z16.string().describe("Identifier of the user who created the action."),
1774
+ createdByRole: z16.string().optional().describe("Role of the user who created the action."),
1748
1775
  createdBySignature: DocumentPath.nullish().describe(
1749
1776
  "Reference to the signature of the user who created the action."
1750
1777
  ),
@@ -1756,7 +1783,7 @@ var ActionBase = z15.object({
1756
1783
  "Declaration data defined by the ActionConfig. Supports partial updates."
1757
1784
  ),
1758
1785
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
1759
- status: z15.enum([
1786
+ status: z16.enum([
1760
1787
  ActionStatus.Requested,
1761
1788
  ActionStatus.Accepted,
1762
1789
  ActionStatus.Rejected
@@ -1768,139 +1795,143 @@ var ActionBase = z15.object({
1768
1795
  )
1769
1796
  });
1770
1797
  var AssignedAction = ActionBase.extend(
1771
- z15.object({
1772
- type: z15.literal(ActionType.ASSIGN),
1773
- assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
1798
+ z16.object({
1799
+ type: z16.literal(ActionType.ASSIGN),
1800
+ assignedTo: z16.string().describe("Identifier of the user to whom the action is assigned.")
1774
1801
  // TODO move into 'content' property
1775
1802
  }).shape
1776
1803
  );
1777
1804
  var UnassignedAction = ActionBase.extend(
1778
- z15.object({
1779
- type: z15.literal(ActionType.UNASSIGN)
1805
+ z16.object({
1806
+ type: z16.literal(ActionType.UNASSIGN)
1780
1807
  }).shape
1781
1808
  );
1782
1809
  var RegisterAction = ActionBase.extend(
1783
- z15.object({
1784
- type: z15.literal(ActionType.REGISTER),
1785
- registrationNumber: z15.string().optional().describe(
1810
+ z16.object({
1811
+ type: z16.literal(ActionType.REGISTER),
1812
+ registrationNumber: z16.string().optional().describe(
1786
1813
  "Registration number of the event. Always present for accepted registrations."
1787
1814
  )
1788
1815
  // TODO move into 'content' property
1789
1816
  }).shape
1790
1817
  );
1791
1818
  var DeclareAction = ActionBase.extend(
1792
- z15.object({
1793
- type: z15.literal(ActionType.DECLARE)
1819
+ z16.object({
1820
+ type: z16.literal(ActionType.DECLARE)
1794
1821
  }).shape
1795
1822
  );
1796
- var ReasonContent = z15.object({
1797
- reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
1823
+ var ReasonContent = z16.object({
1824
+ reason: z16.string().min(1, { error: "Message cannot be empty" }).describe(
1798
1825
  "Message describing the reason for rejecting or archiving the event."
1799
1826
  )
1800
1827
  });
1801
1828
  var RejectAction = ActionBase.extend(
1802
- z15.object({
1803
- type: z15.literal(ActionType.REJECT),
1829
+ z16.object({
1830
+ type: z16.literal(ActionType.REJECT),
1804
1831
  content: ReasonContent
1805
1832
  }).shape
1806
1833
  );
1807
- var PotentialDuplicate = z15.object({
1834
+ var PotentialDuplicate = z16.object({
1808
1835
  id: UUID,
1809
- trackingId: z15.string()
1836
+ trackingId: z16.string()
1810
1837
  });
1811
1838
  var DuplicateDetectedAction = ActionBase.extend(
1812
- z15.object({
1813
- type: z15.literal(ActionType.DUPLICATE_DETECTED),
1814
- content: z15.object({
1815
- duplicates: z15.array(PotentialDuplicate)
1839
+ z16.object({
1840
+ type: z16.literal(ActionType.DUPLICATE_DETECTED),
1841
+ content: z16.object({
1842
+ duplicates: z16.array(PotentialDuplicate)
1816
1843
  })
1817
1844
  }).shape
1818
1845
  );
1819
1846
  var MarkNotDuplicateAction = ActionBase.extend(
1820
- z15.object({
1821
- type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1847
+ z16.object({
1848
+ type: z16.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1822
1849
  }).shape
1823
1850
  );
1824
1851
  var MarkAsDuplicateAction = ActionBase.extend(
1825
- z15.object({
1826
- type: z15.literal(ActionType.MARK_AS_DUPLICATE),
1827
- content: z15.object({
1852
+ z16.object({
1853
+ type: z16.literal(ActionType.MARK_AS_DUPLICATE),
1854
+ content: z16.object({
1828
1855
  duplicateOf: UUID
1829
1856
  }).optional()
1830
1857
  }).shape
1831
1858
  );
1832
1859
  var ArchiveAction = ActionBase.extend(
1833
- z15.object({
1834
- type: z15.literal(ActionType.ARCHIVE),
1835
- content: ReasonContent
1860
+ z16.object({
1861
+ type: z16.literal(ActionType.ARCHIVE),
1862
+ /**
1863
+ * Archiving does not collect a reason on its own. Only the
1864
+ * "mark as duplicate" flow archives with a reason attached.
1865
+ */
1866
+ content: ReasonContent.optional()
1836
1867
  }).shape
1837
1868
  );
1838
1869
  var UnarchiveAction = ActionBase.extend(
1839
- z15.object({
1840
- type: z15.literal(ActionType.UNARCHIVE)
1870
+ z16.object({
1871
+ type: z16.literal(ActionType.UNARCHIVE)
1841
1872
  }).shape
1842
1873
  );
1843
1874
  var CreatedAction = ActionBase.extend(
1844
- z15.object({
1845
- type: z15.literal(ActionType.CREATE)
1875
+ z16.object({
1876
+ type: z16.literal(ActionType.CREATE)
1846
1877
  }).shape
1847
1878
  );
1848
1879
  var NotifiedAction = ActionBase.extend(
1849
- z15.object({
1850
- type: z15.literal(ActionType.NOTIFY)
1880
+ z16.object({
1881
+ type: z16.literal(ActionType.NOTIFY)
1851
1882
  }).shape
1852
1883
  );
1853
1884
  var EditAction = ActionBase.extend(
1854
- z15.object({
1855
- type: z15.literal(ActionType.EDIT),
1885
+ z16.object({
1886
+ type: z16.literal(ActionType.EDIT),
1856
1887
  /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1857
- content: z15.object({
1858
- comment: z15.string().describe("Comment for the edit action.").optional()
1888
+ content: z16.object({
1889
+ comment: z16.string().describe("Comment for the edit action.").optional()
1859
1890
  }).optional()
1860
1891
  }).shape
1861
1892
  );
1862
- var PrintContent = z15.object({
1863
- templateId: z15.string().optional()
1893
+ var PrintContent = z16.object({
1894
+ templateId: z16.string().optional()
1864
1895
  });
1865
1896
  var PrintCertificateAction = ActionBase.extend(
1866
- z15.object({
1867
- type: z15.literal(ActionType.PRINT_CERTIFICATE),
1897
+ z16.object({
1898
+ type: z16.literal(ActionType.PRINT_CERTIFICATE),
1868
1899
  content: PrintContent.optional().nullable()
1869
1900
  }).shape
1870
1901
  );
1871
1902
  var RequestedCorrectionAction = ActionBase.extend(
1872
- z15.object({
1873
- type: z15.literal(ActionType.REQUEST_CORRECTION)
1903
+ z16.object({
1904
+ type: z16.literal(ActionType.REQUEST_CORRECTION)
1874
1905
  }).shape
1875
1906
  );
1876
1907
  var ApprovedCorrectionAction = ActionBase.extend(
1877
- z15.object({
1878
- type: z15.literal(ActionType.APPROVE_CORRECTION),
1879
- requestId: z15.string(),
1908
+ z16.object({
1909
+ type: z16.literal(ActionType.APPROVE_CORRECTION),
1910
+ requestId: z16.string(),
1880
1911
  // TODO move into 'content' property
1881
- content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
1912
+ content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
1882
1913
  }).shape
1883
1914
  );
1884
1915
  var RejectedCorrectionAction = ActionBase.extend(
1885
- z15.object({
1886
- type: z15.literal(ActionType.REJECT_CORRECTION),
1887
- requestId: z15.string(),
1916
+ z16.object({
1917
+ type: z16.literal(ActionType.REJECT_CORRECTION),
1918
+ requestId: z16.string(),
1888
1919
  // TODO move into 'content' property
1889
1920
  content: ReasonContent
1890
1921
  }).shape
1891
1922
  );
1892
1923
  var ReadAction = ActionBase.extend(
1893
- z15.object({
1894
- type: z15.literal(ActionType.READ)
1924
+ z16.object({
1925
+ type: z16.literal(ActionType.READ)
1895
1926
  }).shape
1896
1927
  );
1897
1928
  var CustomAction = ActionBase.merge(
1898
- z15.object({
1899
- type: z15.literal(ActionType.CUSTOM),
1900
- customActionType: z15.string()
1929
+ z16.object({
1930
+ type: z16.literal(ActionType.CUSTOM),
1931
+ customActionType: z16.string()
1901
1932
  })
1902
1933
  );
1903
- var ActionDocument = z15.discriminatedUnion("type", [
1934
+ var ActionDocument = z16.discriminatedUnion("type", [
1904
1935
  CreatedAction.meta({ id: "CreatedAction" }),
1905
1936
  RejectAction.meta({ id: "RejectAction" }),
1906
1937
  DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
@@ -1927,57 +1958,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
1927
1958
  declaration: true,
1928
1959
  annotation: true
1929
1960
  }).extend(
1930
- z15.object({
1931
- type: z15.enum(ConfirmableActions),
1932
- status: z15.literal(ActionStatus.Rejected)
1961
+ z16.object({
1962
+ type: z16.enum(ConfirmableActions),
1963
+ status: z16.literal(ActionStatus.Rejected)
1933
1964
  }).shape
1934
1965
  );
1935
- var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
1966
+ var Action = z16.union([ActionDocument, AsyncRejectActionDocument]);
1936
1967
 
1937
1968
  // ../commons/src/events/EventMetadata.ts
1938
- var EventStatus = z16.enum([
1939
- "CREATED",
1940
- "NOTIFIED",
1941
- "DECLARED",
1942
- "REGISTERED",
1943
- "ARCHIVED"
1944
- ]);
1945
- var ZodDate = z16.iso.date();
1946
- var ZodDateTime = z16.string().datetime();
1947
- var ActionCreationMetadata = z16.object({
1948
- createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
1949
- createdBy: z16.string().describe("ID of the user who created the action request."),
1969
+ var ZodDate = z17.iso.date();
1970
+ var ZodDateTime = z17.string().datetime();
1971
+ var ActionCreationMetadata = z17.object({
1972
+ createdAt: z17.iso.datetime().describe("The timestamp when the action request was created."),
1973
+ createdBy: z17.string().describe("ID of the user who created the action request."),
1950
1974
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1951
1975
  createdAtLocation: UUID.nullish().describe(
1952
1976
  "Location of the user who created the action request."
1953
1977
  ),
1954
- createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1955
- acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1956
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1978
+ createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1979
+ acceptedAt: z17.iso.datetime().describe("Timestamp when the action request was accepted."),
1980
+ createdByRole: z17.string().optional().describe("Role of the user at the time of action request creation.")
1957
1981
  });
1958
1982
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1959
- registrationNumber: z16.string().describe(
1983
+ registrationNumber: z17.string().describe(
1960
1984
  "Registration number of the event. Always present for accepted registrations."
1961
1985
  )
1962
1986
  });
1963
- var LegalStatuses = z16.object({
1987
+ var LegalStatuses = z17.object({
1964
1988
  [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1965
1989
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1966
1990
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1967
1991
  });
1968
- var EventMetadata = z16.object({
1992
+ var EventMetadata = z17.object({
1969
1993
  id: UUID,
1970
- type: z16.string().describe("The type of event, such as birth, death, or marriage."),
1994
+ type: z17.string().describe("The type of event, such as birth, death, or marriage."),
1971
1995
  status: EventStatus,
1972
1996
  legalStatuses: LegalStatuses.describe(
1973
1997
  "Metadata related to the legal registration of the event, such as who registered it and when."
1974
1998
  ),
1975
- createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
1999
+ createdAt: z17.iso.datetime().describe("The timestamp when the event was first created and saved."),
1976
2000
  dateOfEvent: ZodDate.nullish(),
1977
2001
  placeOfEvent: UUID.nullish(),
1978
- createdBy: z16.string().describe("ID of the user who created the event."),
1979
- createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1980
- updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
2002
+ createdBy: z17.string().describe("ID of the user who created the event."),
2003
+ createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
2004
+ updatedByUserRole: z17.string().nullish().describe("Role of the user who last changed the status."),
1981
2005
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1982
2006
  createdAtLocation: UUID.nullish().describe(
1983
2007
  "Location of the user who created the event."
@@ -1985,18 +2009,18 @@ var EventMetadata = z16.object({
1985
2009
  updatedAtLocation: UUID.nullish().describe(
1986
2010
  "Location of the user who last changed the status."
1987
2011
  ),
1988
- updatedAt: z16.iso.datetime().describe(
2012
+ updatedAt: z17.iso.datetime().describe(
1989
2013
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1990
2014
  ),
1991
- assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
1992
- updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
1993
- trackingId: z16.string().describe(
2015
+ assignedTo: z17.string().nullish().describe("ID of the user currently assigned to the event."),
2016
+ updatedBy: z17.string().nullish().describe("ID of the user who last changed the status."),
2017
+ trackingId: z17.string().describe(
1994
2018
  "System-generated tracking ID used by informants or registrars to look up the event."
1995
2019
  ),
1996
- potentialDuplicates: z16.array(PotentialDuplicate).describe(
2020
+ potentialDuplicates: z17.array(PotentialDuplicate).describe(
1997
2021
  "List of event IDs and their tracking IDs that this event could be a duplicate of."
1998
2022
  ),
1999
- flags: z16.array(Flag)
2023
+ flags: z17.array(Flag)
2000
2024
  });
2001
2025
  var EventMetadataKeysArray = [
2002
2026
  "id",
@@ -2017,7 +2041,7 @@ var EventMetadataKeysArray = [
2017
2041
  "legalStatuses",
2018
2042
  "flags"
2019
2043
  ];
2020
- var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
2044
+ var EventMetadataKeys = z17.enum(EventMetadataKeysArray);
2021
2045
  var eventMetadataLabelMap = {
2022
2046
  "event.assignedTo": {
2023
2047
  id: "event.assignedTo.label",
@@ -2100,7 +2124,7 @@ var eventMetadataLabelMap = {
2100
2124
  description: "Flags"
2101
2125
  }
2102
2126
  };
2103
- var EventMetadataDateFieldIdInput = z16.enum([
2127
+ var EventMetadataDateFieldIdInput = z17.enum([
2104
2128
  "createdAt",
2105
2129
  "updatedAt",
2106
2130
  "legalStatuses.NOTIFIED.createdAt",
@@ -2110,7 +2134,7 @@ var EventMetadataDateFieldIdInput = z16.enum([
2110
2134
  "legalStatuses.REGISTERED.createdAt",
2111
2135
  "legalStatuses.REGISTERED.acceptedAt"
2112
2136
  ]);
2113
- var EventMetadataDateFieldId = z16.enum([
2137
+ var EventMetadataDateFieldId = z17.enum([
2114
2138
  "event.createdAt",
2115
2139
  "event.updatedAt",
2116
2140
  "event.legalStatuses.NOTIFIED.createdAt",
@@ -2802,10 +2826,13 @@ var AdministrativeAreaField = BaseField.extend({
2802
2826
  type: AdministrativeAreas,
2803
2827
  allowedLocations: AllowedLocations,
2804
2828
  listHistoricalNames: import_v43.default.boolean().optional().describe(
2805
- "Advanced search: list every historical name a location has had as a separate, selectable option."
2829
+ "List every historical name a location has had as a separate, selectable option."
2806
2830
  ),
2807
2831
  activeOnly: import_v43.default.boolean().optional().describe(
2808
- "Advanced search: offer only currently-active locations; inactivated ones are excluded."
2832
+ "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."
2833
+ ),
2834
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
2835
+ "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."
2809
2836
  )
2810
2837
  }).describe("Administrative area options")
2811
2838
  }).meta({
@@ -2819,7 +2846,13 @@ var LocationInput = BaseField.extend({
2819
2846
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2820
2847
  allowedLocations: AllowedLocations,
2821
2848
  listHistoricalNames: import_v43.default.boolean().optional().describe(
2822
- "Advanced search: list every historical name a location has had as a separate, selectable option."
2849
+ "List every historical name a location has had as a separate, selectable option."
2850
+ ),
2851
+ activeOnly: import_v43.default.boolean().optional().describe(
2852
+ "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."
2853
+ ),
2854
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
2855
+ "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."
2823
2856
  )
2824
2857
  }).optional()
2825
2858
  }).meta({
@@ -2848,7 +2881,9 @@ var Facility = BaseField.extend({
2848
2881
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2849
2882
  configuration: import_v43.default.object({
2850
2883
  allowedLocations: AllowedLocations,
2851
- listHistoricalNames: import_v43.default.boolean().optional()
2884
+ listHistoricalNames: import_v43.default.boolean().optional(),
2885
+ activeOnly: import_v43.default.boolean().optional(),
2886
+ anchorToDateOfEvent: import_v43.default.boolean().optional()
2852
2887
  }).optional()
2853
2888
  }).describe("Input field for a facility");
2854
2889
  var Office = BaseField.extend({
@@ -2856,7 +2891,9 @@ var Office = BaseField.extend({
2856
2891
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2857
2892
  configuration: import_v43.default.object({
2858
2893
  allowedLocations: AllowedLocations,
2859
- listHistoricalNames: import_v43.default.boolean().optional()
2894
+ listHistoricalNames: import_v43.default.boolean().optional(),
2895
+ activeOnly: import_v43.default.boolean().optional(),
2896
+ anchorToDateOfEvent: import_v43.default.boolean().optional()
2860
2897
  }).optional()
2861
2898
  }).describe("Input field for an office");
2862
2899
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2892,10 +2929,13 @@ var Address = BaseField.extend({
2892
2929
  ).optional(),
2893
2930
  allowedLocations: AllowedLocations,
2894
2931
  listHistoricalNames: import_v43.default.boolean().optional().describe(
2895
- "Advanced search: list every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
2932
+ "List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
2896
2933
  ),
2897
2934
  activeOnly: import_v43.default.boolean().optional().describe(
2898
- "Advanced search: offer only currently-active admin areas; inactivated ones are excluded. Propagated to the embedded admin-area selectors."
2935
+ "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."
2936
+ ),
2937
+ anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
2938
+ "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."
2899
2939
  )
2900
2940
  }).optional(),
2901
2941
  defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
@@ -3197,18 +3237,18 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
3197
3237
  ]);
3198
3238
 
3199
3239
  // ../commons/src/events/FormConfig.ts
3200
- var z22 = __toESM(require("zod/v4"));
3240
+ var z23 = __toESM(require("zod/v4"));
3201
3241
 
3202
3242
  // ../commons/src/events/PageConfig.ts
3203
- var z21 = __toESM(require("zod/v4"));
3204
- var PageTypes = z21.enum(["FORM", "VERIFICATION"]);
3205
- var PageConfigBase = z21.object({
3206
- id: z21.string().describe("Unique identifier for the page"),
3243
+ var z22 = __toESM(require("zod/v4"));
3244
+ var PageTypes = z22.enum(["FORM", "VERIFICATION"]);
3245
+ var PageConfigBase = z22.object({
3246
+ id: z22.string().describe("Unique identifier for the page"),
3207
3247
  title: TranslationConfig.describe("Header title of the page"),
3208
- requireCompletionToContinue: z21.boolean().default(false).describe(
3248
+ requireCompletionToContinue: z22.boolean().default(false).describe(
3209
3249
  "If true, all required fields must be filled before continuing to the next page"
3210
3250
  ),
3211
- fields: z21.array(FieldConfig).describe("Fields to be rendered on the page"),
3251
+ fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
3212
3252
  conditional: Conditional.optional().describe(
3213
3253
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
3214
3254
  )
@@ -3217,13 +3257,13 @@ var PageConfigBase = z21.object({
3217
3257
  id: "FormPageConfig"
3218
3258
  });
3219
3259
  var FormPageConfig = PageConfigBase.extend({
3220
- type: z21.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
3260
+ type: z22.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
3221
3261
  });
3222
- var VerificationActionConfig = z21.object({
3223
- verify: z21.object({ label: TranslationConfig }),
3224
- cancel: z21.object({
3262
+ var VerificationActionConfig = z22.object({
3263
+ verify: z22.object({ label: TranslationConfig }),
3264
+ cancel: z22.object({
3225
3265
  label: TranslationConfig,
3226
- confirmation: z21.object({
3266
+ confirmation: z22.object({
3227
3267
  title: TranslationConfig,
3228
3268
  body: TranslationConfig
3229
3269
  })
@@ -3233,34 +3273,34 @@ var VerificationActionConfig = z21.object({
3233
3273
  id: "VerificationActionConfig"
3234
3274
  });
3235
3275
  var VerificationPageConfig = FormPageConfig.extend({
3236
- type: z21.literal(PageTypes.enum.VERIFICATION),
3276
+ type: z22.literal(PageTypes.enum.VERIFICATION),
3237
3277
  actions: VerificationActionConfig
3238
3278
  });
3239
- var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
3279
+ var PageConfig = z22.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
3240
3280
  id: "PageConfig",
3241
3281
  description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
3242
3282
  });
3243
3283
 
3244
3284
  // ../commons/src/events/FormConfig.ts
3245
- var DeclarationFormConfig = z22.object({
3285
+ var DeclarationFormConfig = z23.object({
3246
3286
  label: TranslationConfig.describe("Human readable description of the form"),
3247
- pages: z22.array(FormPageConfig)
3287
+ pages: z23.array(FormPageConfig)
3248
3288
  }).meta({
3249
3289
  id: "DeclarationFormConfig",
3250
3290
  description: "Configuration of the declaration form."
3251
3291
  });
3252
- var ActionFormConfig = z22.object({
3292
+ var ActionFormConfig = z23.object({
3253
3293
  label: TranslationConfig.describe("Human readable description of the form"),
3254
- pages: z22.array(PageConfig)
3294
+ pages: z23.array(PageConfig)
3255
3295
  }).describe(
3256
3296
  "Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
3257
3297
  );
3258
- var FormConfig = z22.union([DeclarationFormConfig, ActionFormConfig]);
3298
+ var FormConfig = z23.union([DeclarationFormConfig, ActionFormConfig]);
3259
3299
 
3260
3300
  // ../commons/src/events/DeduplicationConfig.ts
3261
- var z23 = __toESM(require("zod/v4"));
3262
- var FieldReference2 = z23.string();
3263
- var Matcher = z23.object({
3301
+ var z24 = __toESM(require("zod/v4"));
3302
+ var FieldReference2 = z24.string();
3303
+ var Matcher = z24.object({
3264
3304
  /**
3265
3305
  * Reference to the field used in matching.
3266
3306
  *
@@ -3268,23 +3308,23 @@ var Matcher = z23.object({
3268
3308
  * be used as the origin date to calculate the distance from.
3269
3309
  */
3270
3310
  fieldId: FieldReference2,
3271
- options: z23.object({
3272
- boost: z23.number().optional(),
3311
+ options: z24.object({
3312
+ boost: z24.number().optional(),
3273
3313
  matchAgainst: FieldReference2.optional()
3274
3314
  }).optional().default({
3275
3315
  boost: 1
3276
3316
  })
3277
3317
  });
3278
3318
  var FuzzyMatcher = Matcher.extend({
3279
- type: z23.literal("fuzzy"),
3280
- options: z23.object({
3319
+ type: z24.literal("fuzzy"),
3320
+ options: z24.object({
3281
3321
  /**
3282
3322
  * Names of length 3 or less characters = 0 edits allowed
3283
3323
  * Names of length 4 - 6 characters = 1 edit allowed
3284
3324
  * Names of length >7 characters = 2 edits allowed
3285
3325
  */
3286
- fuzziness: z23.union([z23.string(), z23.number()]).optional().default("AUTO:4,7"),
3287
- boost: z23.number().optional().default(1),
3326
+ fuzziness: z24.union([z24.string(), z24.number()]).optional().default("AUTO:4,7"),
3327
+ boost: z24.number().optional().default(1),
3288
3328
  matchAgainst: FieldReference2.optional()
3289
3329
  }).optional().default({
3290
3330
  fuzziness: "AUTO:4,7",
@@ -3292,48 +3332,48 @@ var FuzzyMatcher = Matcher.extend({
3292
3332
  })
3293
3333
  });
3294
3334
  var StrictMatcher = Matcher.extend({
3295
- type: z23.literal("strict"),
3296
- options: z23.object({
3297
- boost: z23.number().optional().default(1),
3335
+ type: z24.literal("strict"),
3336
+ options: z24.object({
3337
+ boost: z24.number().optional().default(1),
3298
3338
  /**
3299
3339
  * The constant value to be present in the field for both records
3300
3340
  */
3301
- value: z23.string().optional(),
3341
+ value: z24.string().optional(),
3302
3342
  matchAgainst: FieldReference2.optional()
3303
3343
  }).optional().default({
3304
3344
  boost: 1
3305
3345
  })
3306
3346
  });
3307
3347
  var DateRangeMatcher = Matcher.extend({
3308
- type: z23.literal("dateRange"),
3309
- options: z23.object({
3348
+ type: z24.literal("dateRange"),
3349
+ options: z24.object({
3310
3350
  /**
3311
3351
  * The distance pivot in days. Distance from the origin (the value of
3312
3352
  * fieldId) at which relevance scores receive half of the boost value
3313
3353
  */
3314
- pivot: z23.number().optional(),
3315
- days: z23.number(),
3316
- boost: z23.number().optional().default(1),
3354
+ pivot: z24.number().optional(),
3355
+ days: z24.number(),
3356
+ boost: z24.number().optional().default(1),
3317
3357
  matchAgainst: FieldReference2.optional()
3318
3358
  })
3319
3359
  });
3320
- var Not = z23.object({
3321
- type: z23.literal("not"),
3360
+ var Not = z24.object({
3361
+ type: z24.literal("not"),
3322
3362
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
3323
- clause: z23.lazy(() => Clause)
3363
+ clause: z24.lazy(() => Clause)
3324
3364
  });
3325
- var And = z23.object({
3326
- type: z23.literal("and"),
3365
+ var And = z24.object({
3366
+ type: z24.literal("and"),
3327
3367
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
3328
- clauses: z23.lazy(() => Clause.array())
3368
+ clauses: z24.lazy(() => Clause.array())
3329
3369
  });
3330
- var Or = z23.object({
3331
- type: z23.literal("or"),
3370
+ var Or = z24.object({
3371
+ type: z24.literal("or"),
3332
3372
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
3333
- clauses: z23.lazy(() => Clause.array())
3373
+ clauses: z24.lazy(() => Clause.array())
3334
3374
  });
3335
- var Clause = z23.lazy(
3336
- () => z23.discriminatedUnion("type", [
3375
+ var Clause = z24.lazy(
3376
+ () => z24.discriminatedUnion("type", [
3337
3377
  Not,
3338
3378
  And,
3339
3379
  Or,
@@ -3344,8 +3384,8 @@ var Clause = z23.lazy(
3344
3384
  ).meta({
3345
3385
  id: "Clause"
3346
3386
  });
3347
- var DeduplicationConfig = z23.object({
3348
- id: z23.string(),
3387
+ var DeduplicationConfig = z24.object({
3388
+ id: z24.string(),
3349
3389
  label: TranslationConfig,
3350
3390
  query: Clause
3351
3391
  }).meta({
@@ -3354,15 +3394,15 @@ var DeduplicationConfig = z23.object({
3354
3394
  });
3355
3395
 
3356
3396
  // ../commons/src/events/ActionConfig.ts
3357
- var DeclarationReviewConfig = z24.object({
3397
+ var DeclarationReviewConfig = z25.object({
3358
3398
  title: TranslationConfig.describe("Title of the review page"),
3359
- fields: z24.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
3399
+ fields: z25.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
3360
3400
  }).describe(
3361
3401
  "Configuration of the declaration review page for collecting event-related metadata."
3362
3402
  );
3363
- var ActionConfigBase = z24.object({
3403
+ var ActionConfigBase = z25.object({
3364
3404
  label: TranslationConfig.describe("Human readable description of the action"),
3365
- flags: z24.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
3405
+ flags: z25.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
3366
3406
  supportingCopy: TranslationConfig.optional().describe(
3367
3407
  "Text displayed on the confirmation dialog"
3368
3408
  ),
@@ -3373,84 +3413,84 @@ var ActionConfigBase = z24.object({
3373
3413
  * "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
3374
3414
  * for EventConfig.d.ts.
3375
3415
  */
3376
- icon: z24.string().describe("Icon representing the action").optional(),
3377
- conditionals: z24.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
3416
+ icon: z25.string().describe("Icon representing the action").optional(),
3417
+ conditionals: z25.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
3378
3418
  });
3379
3419
  var DeclarationActionBase = ActionConfigBase.extend({
3380
3420
  deduplication: DeduplicationConfig.optional()
3381
3421
  });
3382
- var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
3422
+ var actionConfirmationForm = z25.array(FieldConfig).optional().describe(
3383
3423
  "Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
3384
3424
  );
3385
3425
  var ReadActionConfig = ActionConfigBase.extend(
3386
- z24.object({
3387
- type: z24.literal(ActionType.READ),
3426
+ z25.object({
3427
+ type: z25.literal(ActionType.READ),
3388
3428
  review: DeclarationReviewConfig.describe(
3389
3429
  "Configuration of the review page for read-only view."
3390
3430
  ),
3391
- conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
3431
+ conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
3392
3432
  }).shape
3393
3433
  );
3394
3434
  var NotifyConfig = ActionConfigBase.extend(
3395
- z24.object({
3396
- type: z24.literal(ActionType.NOTIFY),
3435
+ z25.object({
3436
+ type: z25.literal(ActionType.NOTIFY),
3397
3437
  form: actionConfirmationForm
3398
3438
  }).shape
3399
3439
  );
3400
3440
  var DuplicateDetectedConfig = ActionConfigBase.extend(
3401
- z24.object({
3402
- type: z24.literal(ActionType.DUPLICATE_DETECTED),
3403
- label: z24.never().optional().describe(
3441
+ z25.object({
3442
+ type: z25.literal(ActionType.DUPLICATE_DETECTED),
3443
+ label: z25.never().optional().describe(
3404
3444
  "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
3405
3445
  ),
3406
- supportingCopy: z24.never().optional(),
3407
- icon: z24.never().optional().describe(
3446
+ supportingCopy: z25.never().optional(),
3447
+ icon: z25.never().optional().describe(
3408
3448
  "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
3409
3449
  ),
3410
- conditionals: z24.never().optional().describe(
3450
+ conditionals: z25.never().optional().describe(
3411
3451
  "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
3412
3452
  )
3413
3453
  }).shape
3414
3454
  );
3415
3455
  var MarkAsDuplicateConfig = ActionConfigBase.extend(
3416
- z24.object({
3417
- type: z24.literal(ActionType.MARK_AS_DUPLICATE)
3456
+ z25.object({
3457
+ type: z25.literal(ActionType.MARK_AS_DUPLICATE)
3418
3458
  }).shape
3419
3459
  );
3420
3460
  var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
3421
- z24.object({
3422
- type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
3461
+ z25.object({
3462
+ type: z25.literal(ActionType.MARK_AS_NOT_DUPLICATE)
3423
3463
  }).shape
3424
3464
  );
3425
3465
  var AssignConfig = ActionConfigBase.extend(
3426
- z24.object({
3427
- type: z24.literal(ActionType.ASSIGN),
3428
- flags: z24.never().optional().describe(
3466
+ z25.object({
3467
+ type: z25.literal(ActionType.ASSIGN),
3468
+ flags: z25.never().optional().describe(
3429
3469
  "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3430
3470
  )
3431
3471
  }).shape
3432
3472
  );
3433
3473
  var UnassignConfig = ActionConfigBase.extend(
3434
- z24.object({
3435
- type: z24.literal(ActionType.UNASSIGN),
3436
- flags: z24.never().optional().describe(
3474
+ z25.object({
3475
+ type: z25.literal(ActionType.UNASSIGN),
3476
+ flags: z25.never().optional().describe(
3437
3477
  "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3438
3478
  )
3439
3479
  }).shape
3440
3480
  );
3441
3481
  var DeleteConfig = ActionConfigBase.extend(
3442
- z24.object({
3443
- type: z24.literal(ActionType.DELETE)
3482
+ z25.object({
3483
+ type: z25.literal(ActionType.DELETE)
3444
3484
  }).shape
3445
3485
  );
3446
3486
  var DeclareConfig = DeclarationActionBase.extend(
3447
- z24.object({
3448
- type: z24.literal(ActionType.DECLARE),
3487
+ z25.object({
3488
+ type: z25.literal(ActionType.DECLARE),
3449
3489
  review: DeclarationReviewConfig.describe(
3450
3490
  "Configuration of the review page fields."
3451
3491
  ),
3452
3492
  form: actionConfirmationForm,
3453
- dialogCopy: z24.object({
3493
+ dialogCopy: z25.object({
3454
3494
  notify: TranslationConfig.describe(
3455
3495
  "Confirmation text for the notify action"
3456
3496
  ),
@@ -3464,20 +3504,20 @@ var DeclareConfig = DeclarationActionBase.extend(
3464
3504
  }).shape
3465
3505
  );
3466
3506
  var ArchiveConfig = ActionConfigBase.extend(
3467
- z24.object({
3468
- type: z24.literal(ActionType.ARCHIVE),
3507
+ z25.object({
3508
+ type: z25.literal(ActionType.ARCHIVE),
3469
3509
  form: actionConfirmationForm
3470
3510
  }).shape
3471
3511
  );
3472
3512
  var UnarchiveConfig = ActionConfigBase.extend(
3473
- z24.object({
3474
- type: z24.literal(ActionType.UNARCHIVE)
3513
+ z25.object({
3514
+ type: z25.literal(ActionType.UNARCHIVE)
3475
3515
  }).shape
3476
3516
  );
3477
3517
  var EditActionConfig = ActionConfigBase.extend(
3478
- z24.object({
3479
- type: z24.literal(ActionType.EDIT),
3480
- dialogCopy: z24.object({
3518
+ z25.object({
3519
+ type: z25.literal(ActionType.EDIT),
3520
+ dialogCopy: z25.object({
3481
3521
  notify: TranslationConfig.describe(
3482
3522
  "Confirmation text for the notify with edits action"
3483
3523
  ),
@@ -3491,45 +3531,45 @@ var EditActionConfig = ActionConfigBase.extend(
3491
3531
  }).shape
3492
3532
  );
3493
3533
  var RejectConfig = ActionConfigBase.extend(
3494
- z24.object({
3495
- type: z24.literal(ActionType.REJECT),
3534
+ z25.object({
3535
+ type: z25.literal(ActionType.REJECT),
3496
3536
  form: actionConfirmationForm
3497
3537
  }).shape
3498
3538
  );
3499
3539
  var RegisterConfig = DeclarationActionBase.extend(
3500
- z24.object({
3501
- type: z24.literal(ActionType.REGISTER),
3540
+ z25.object({
3541
+ type: z25.literal(ActionType.REGISTER),
3502
3542
  form: actionConfirmationForm
3503
3543
  }).shape
3504
3544
  );
3505
3545
  var PrintCertificateActionConfig = ActionConfigBase.extend(
3506
- z24.object({
3507
- type: z24.literal(ActionType.PRINT_CERTIFICATE),
3546
+ z25.object({
3547
+ type: z25.literal(ActionType.PRINT_CERTIFICATE),
3508
3548
  printForm: ActionFormConfig
3509
3549
  }).shape
3510
3550
  );
3511
3551
  var RequestCorrectionConfig = ActionConfigBase.extend(
3512
- z24.object({
3513
- type: z24.literal(ActionType.REQUEST_CORRECTION),
3552
+ z25.object({
3553
+ type: z25.literal(ActionType.REQUEST_CORRECTION),
3514
3554
  correctionForm: ActionFormConfig
3515
3555
  }).shape
3516
3556
  );
3517
3557
  var ApproveCorrectionConfig = ActionConfigBase.extend(
3518
- z24.object({
3519
- type: z24.literal(ActionType.APPROVE_CORRECTION)
3558
+ z25.object({
3559
+ type: z25.literal(ActionType.APPROVE_CORRECTION)
3520
3560
  }).shape
3521
3561
  );
3522
3562
  var RejectCorrectionConfig = ActionConfigBase.extend(
3523
- z24.object({
3524
- type: z24.literal(ActionType.REJECT_CORRECTION)
3563
+ z25.object({
3564
+ type: z25.literal(ActionType.REJECT_CORRECTION)
3525
3565
  }).shape
3526
3566
  );
3527
3567
  var CustomActionConfig = ActionConfigBase.extend(
3528
- z24.object({
3529
- type: z24.literal(ActionType.CUSTOM),
3530
- customActionType: z24.string().describe("Type identifier of the custom action."),
3568
+ z25.object({
3569
+ type: z25.literal(ActionType.CUSTOM),
3570
+ customActionType: z25.string().describe("Type identifier of the custom action."),
3531
3571
  /** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
3532
- form: z24.array(FieldConfig).describe(
3572
+ form: z25.array(FieldConfig).describe(
3533
3573
  "Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
3534
3574
  ),
3535
3575
  auditHistoryLabel: TranslationConfig.describe(
@@ -3537,7 +3577,7 @@ var CustomActionConfig = ActionConfigBase.extend(
3537
3577
  )
3538
3578
  }).shape
3539
3579
  );
3540
- var ActionConfig = z24.discriminatedUnion("type", [
3580
+ var ActionConfig = z25.discriminatedUnion("type", [
3541
3581
  /*
3542
3582
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
3543
3583
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
@@ -3624,58 +3664,58 @@ var ActionConfig = z24.discriminatedUnion("type", [
3624
3664
  var actionConfigTypes = new Set(
3625
3665
  ActionConfig.options.map((opt) => opt.shape.type.value)
3626
3666
  );
3627
- var DeclarationActionConfig = z24.discriminatedUnion("type", [
3667
+ var DeclarationActionConfig = z25.discriminatedUnion("type", [
3628
3668
  DeclareConfig,
3629
3669
  RegisterConfig
3630
3670
  ]);
3631
3671
 
3632
3672
  // ../commons/src/events/offline/CertificateConfig.ts
3633
- var z25 = __toESM(require("zod/v4"));
3634
- var FontFamily = z25.object({
3635
- normal: z25.string(),
3636
- bold: z25.string(),
3637
- italics: z25.string(),
3638
- bolditalics: z25.string()
3639
- });
3640
- var CertificateConfig = z25.object({
3641
- id: z25.string(),
3642
- event: z25.string(),
3643
- isV2Template: z25.boolean().optional(),
3673
+ var z26 = __toESM(require("zod/v4"));
3674
+ var FontFamily = z26.object({
3675
+ normal: z26.string(),
3676
+ bold: z26.string(),
3677
+ italics: z26.string(),
3678
+ bolditalics: z26.string()
3679
+ });
3680
+ var CertificateConfig = z26.object({
3681
+ id: z26.string(),
3682
+ event: z26.string(),
3683
+ isV2Template: z26.boolean().optional(),
3644
3684
  label: TranslationConfig,
3645
- isDefault: z25.boolean(),
3646
- fee: z25.object({
3647
- onTime: z25.number(),
3648
- late: z25.number(),
3649
- delayed: z25.number()
3685
+ isDefault: z26.boolean(),
3686
+ fee: z26.object({
3687
+ onTime: z26.number(),
3688
+ late: z26.number(),
3689
+ delayed: z26.number()
3650
3690
  }),
3651
- svgUrl: z25.string(),
3652
- fonts: z25.record(z25.string(), FontFamily).optional(),
3653
- conditionals: z25.array(ShowConditional).optional()
3691
+ svgUrl: z26.string(),
3692
+ fonts: z26.record(z26.string(), FontFamily).optional(),
3693
+ conditionals: z26.array(ShowConditional).optional()
3654
3694
  });
3655
3695
  var CertificateTemplateConfig = CertificateConfig.extend({
3656
- hash: z25.string().optional(),
3657
- svg: z25.string()
3696
+ hash: z26.string().optional(),
3697
+ svg: z26.string()
3658
3698
  });
3659
3699
 
3660
3700
  // ../commons/src/events/offline/LanguageConfig.ts
3661
- var z26 = __toESM(require("zod/v4"));
3662
- var LanguageConfig = z26.object({
3663
- lang: z26.string(),
3701
+ var z27 = __toESM(require("zod/v4"));
3702
+ var LanguageConfig = z27.object({
3703
+ lang: z27.string(),
3664
3704
  /**
3665
3705
  * client.csv contents
3666
3706
  */
3667
- messages: z26.record(z26.string(), z26.string())
3707
+ messages: z27.record(z27.string(), z27.string())
3668
3708
  });
3669
3709
 
3670
3710
  // ../commons/src/events/EventConfig.ts
3671
- var z34 = __toESM(require("zod/v4"));
3711
+ var z35 = __toESM(require("zod/v4"));
3672
3712
 
3673
3713
  // ../commons/src/events/SummaryConfig.ts
3674
- var z28 = __toESM(require("zod/v4"));
3714
+ var z29 = __toESM(require("zod/v4"));
3675
3715
 
3676
3716
  // ../commons/src/icons.ts
3677
- var z27 = __toESM(require("zod/v4"));
3678
- var AvailableIcons = z27.enum([
3717
+ var z28 = __toESM(require("zod/v4"));
3718
+ var AvailableIcons = z28.enum([
3679
3719
  "Archived",
3680
3720
  "Assigned",
3681
3721
  "Briefcase",
@@ -3783,11 +3823,11 @@ var AvailableIcons = z27.enum([
3783
3823
  ]);
3784
3824
 
3785
3825
  // ../commons/src/events/SummaryConfig.ts
3786
- var InfoBox = z28.object({
3787
- type: z28.enum(["info", "positive", "warning", "negative"]).describe(
3826
+ var InfoBox = z29.object({
3827
+ type: z29.enum(["info", "positive", "warning", "negative"]).describe(
3788
3828
  "Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
3789
3829
  ),
3790
- background: z28.enum(["tinted", "white"]).default("tinted").optional().describe(
3830
+ background: z29.enum(["tinted", "white"]).default("tinted").optional().describe(
3791
3831
  "tinted reads as a recessed empty state; white reads as a standalone card."
3792
3832
  ),
3793
3833
  icon: AvailableIcons.optional().describe(
@@ -3799,50 +3839,50 @@ var InfoBox = z28.object({
3799
3839
  description: TranslationConfig.optional().describe(
3800
3840
  "Secondary copy displayed below the heading, typically a suggested next step."
3801
3841
  ),
3802
- conditionals: z28.array(ShowConditional).default([]).optional().describe(
3842
+ conditionals: z29.array(ShowConditional).default([]).optional().describe(
3803
3843
  "Conditions under which the info box is shown. When omitted, it is always shown."
3804
3844
  )
3805
3845
  }).describe(
3806
3846
  "A compact icon-block + heading + description block displayed above the summary fields in the event overview."
3807
3847
  );
3808
- var BaseField2 = z28.object({
3848
+ var BaseField2 = z29.object({
3809
3849
  emptyValueMessage: TranslationConfig.optional().describe(
3810
3850
  "Default message displayed when the field value is empty."
3811
3851
  ),
3812
- conditionals: z28.array(ShowConditional).default([]).optional()
3852
+ conditionals: z29.array(ShowConditional).default([]).optional()
3813
3853
  });
3814
3854
  var ReferenceField = BaseField2.extend({
3815
- fieldId: z28.string(),
3855
+ fieldId: z29.string(),
3816
3856
  label: TranslationConfig.optional().describe(
3817
3857
  "Overrides the default label from the referenced field when provided."
3818
3858
  )
3819
3859
  }).describe("Field referencing existing event data by field ID.");
3820
3860
  var Field = BaseField2.extend({
3821
- id: z28.string().describe("Identifier of the summary field."),
3861
+ id: z29.string().describe("Identifier of the summary field."),
3822
3862
  value: TranslationConfig.describe(
3823
3863
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
3824
3864
  ),
3825
3865
  label: TranslationConfig
3826
3866
  }).describe("Custom field defined for the summary view.");
3827
- var SummaryConfig = z28.object({
3828
- banners: z28.array(InfoBox).default([]).optional().describe(
3867
+ var SummaryConfig = z29.object({
3868
+ banners: z29.array(InfoBox).default([]).optional().describe(
3829
3869
  "Info boxes displayed above the summary fields in the event overview."
3830
3870
  ),
3831
- fields: z28.array(z28.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3871
+ fields: z29.array(z29.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3832
3872
  }).meta({
3833
3873
  id: "SummaryConfig",
3834
3874
  description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
3835
3875
  });
3836
3876
 
3837
3877
  // ../commons/src/events/AdvancedSearchConfig.ts
3838
- var z29 = __toESM(require("zod/v4"));
3839
- var MatchType = z29.enum(["fuzzy", "exact", "range", "within"]);
3840
- var BaseField3 = z29.object({
3841
- config: z29.object({
3878
+ var z30 = __toESM(require("zod/v4"));
3879
+ var MatchType = z30.enum(["fuzzy", "exact", "range", "within"]);
3880
+ var BaseField3 = z30.object({
3881
+ config: z30.object({
3842
3882
  type: MatchType.describe(
3843
3883
  "Determines the search type of field. How to match value."
3844
3884
  ),
3845
- searchFields: z29.array(z29.string()).optional().describe(
3885
+ searchFields: z30.array(z30.string()).optional().describe(
3846
3886
  `
3847
3887
  Defines multiple form fields that should be searched when this field has a value.
3848
3888
  All specified fields will be combined using OR logic.
@@ -3852,7 +3892,7 @@ var BaseField3 = z29.object({
3852
3892
  `
3853
3893
  )
3854
3894
  }),
3855
- type: z29.nativeEnum(FieldType).optional().describe(
3895
+ type: z30.nativeEnum(FieldType).optional().describe(
3856
3896
  `
3857
3897
  Explicitly specify the field type for searchFields.
3858
3898
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -3866,7 +3906,7 @@ var BaseField3 = z29.object({
3866
3906
  This is required when searchFields is defined.
3867
3907
  `
3868
3908
  ),
3869
- options: z29.array(SelectOption).optional(),
3909
+ options: z30.array(SelectOption).optional(),
3870
3910
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
3871
3911
  `
3872
3912
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -3887,7 +3927,7 @@ var BaseField3 = z29.object({
3887
3927
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
3888
3928
  `
3889
3929
  ),
3890
- conditionals: z29.array(FieldConditional).optional().describe(
3930
+ conditionals: z30.array(FieldConditional).optional().describe(
3891
3931
  `
3892
3932
  In advanced search, we sometimes need to override the default field visibility conditionals.
3893
3933
 
@@ -3901,23 +3941,23 @@ var BaseField3 = z29.object({
3901
3941
  are always rendered in the advanced search form.
3902
3942
  `
3903
3943
  ),
3904
- validations: z29.array(ValidationConfig).optional().describe(
3944
+ validations: z30.array(ValidationConfig).optional().describe(
3905
3945
  `Option for overriding the field validations specifically for advanced search form.`
3906
3946
  ),
3907
3947
  allowedLocations: JurisdictionReference.optional().describe(
3908
3948
  `Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
3909
3949
  )
3910
3950
  });
3911
- var SearchQueryParams = z29.object({
3912
- eventType: z29.string().optional().describe(
3951
+ var SearchQueryParams = z30.object({
3952
+ eventType: z30.string().optional().describe(
3913
3953
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
3914
3954
  )
3915
3955
  }).catchall(FieldValue);
3916
3956
  var FieldConfigSchema = BaseField3.extend({
3917
- fieldId: z29.string(),
3918
- fieldType: z29.literal("field")
3957
+ fieldId: z30.string(),
3958
+ fieldType: z30.literal("field")
3919
3959
  });
3920
- var EventFieldIdInput = z29.enum([
3960
+ var EventFieldIdInput = z30.enum([
3921
3961
  "trackingId",
3922
3962
  "status",
3923
3963
  "legalStatuses.REGISTERED.acceptedAt",
@@ -3926,7 +3966,7 @@ var EventFieldIdInput = z29.enum([
3926
3966
  "updatedAt"
3927
3967
  ]);
3928
3968
  var METADATA_FIELD_PREFIX = "event.";
3929
- var EventFieldId = z29.enum([
3969
+ var EventFieldId = z30.enum([
3930
3970
  `${METADATA_FIELD_PREFIX}trackingId`,
3931
3971
  `${METADATA_FIELD_PREFIX}status`,
3932
3972
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -3936,29 +3976,29 @@ var EventFieldId = z29.enum([
3936
3976
  ]);
3937
3977
  var EventFieldConfigSchema = BaseField3.extend({
3938
3978
  fieldId: EventFieldId,
3939
- fieldType: z29.literal("event")
3979
+ fieldType: z30.literal("event")
3940
3980
  });
3941
- var AdvancedSearchField = z29.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3981
+ var AdvancedSearchField = z30.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3942
3982
  if (data.config.searchFields && data.config.searchFields.length > 0) {
3943
3983
  if (!data.label) {
3944
3984
  ctx.addIssue({
3945
- code: z29.ZodIssueCode.custom,
3985
+ code: z30.ZodIssueCode.custom,
3946
3986
  message: "label is required when config.searchFields is defined.",
3947
3987
  path: ["label"]
3948
3988
  });
3949
3989
  }
3950
3990
  if (!data.type) {
3951
3991
  ctx.addIssue({
3952
- code: z29.ZodIssueCode.custom,
3992
+ code: z30.ZodIssueCode.custom,
3953
3993
  message: "type is required when config.searchFields is defined.",
3954
3994
  path: ["type"]
3955
3995
  });
3956
3996
  }
3957
3997
  }
3958
3998
  });
3959
- var AdvancedSearchConfig = z29.object({
3999
+ var AdvancedSearchConfig = z30.object({
3960
4000
  title: TranslationConfig.describe("Advanced search tab title"),
3961
- fields: z29.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
4001
+ fields: z30.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3962
4002
  }).meta({
3963
4003
  id: "AdvancedSearchConfig",
3964
4004
  description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
@@ -3970,19 +4010,19 @@ var import_lodash4 = require("lodash");
3970
4010
  // ../commons/src/conditionals/validate.ts
3971
4011
  var import__ = __toESM(require("ajv/dist/2019"));
3972
4012
  var import_ajv_formats = __toESM(require("ajv-formats"));
3973
- var z33 = __toESM(require("zod/v4"));
4013
+ var z34 = __toESM(require("zod/v4"));
3974
4014
  var import_date_fns2 = require("date-fns");
3975
4015
 
3976
4016
  // ../commons/src/events/FieldTypeMapping.ts
3977
- var z31 = __toESM(require("zod/v4"));
4017
+ var z32 = __toESM(require("zod/v4"));
3978
4018
 
3979
4019
  // ../commons/src/events/DynamicFieldValue.ts
3980
- var z30 = __toESM(require("zod/v4"));
4020
+ var z31 = __toESM(require("zod/v4"));
3981
4021
  function getDynamicNameValue(field3) {
3982
4022
  const nameConfiguration = field3.configuration?.name;
3983
4023
  const firstnameRequired = nameConfiguration?.firstname?.required ?? field3.required;
3984
4024
  const surnameRequired = nameConfiguration?.surname?.required ?? field3.required;
3985
- return z30.object({
4025
+ return z31.object({
3986
4026
  firstname: firstnameRequired ? NonEmptyTextValue : TextValue,
3987
4027
  surname: surnameRequired ? NonEmptyTextValue : TextValue,
3988
4028
  middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
@@ -4013,7 +4053,7 @@ function mapFieldTypeToZod(field3, actionType) {
4013
4053
  let schema;
4014
4054
  switch (field3.type) {
4015
4055
  case FieldType.FIELD_GROUP: {
4016
- schema = z31.object(
4056
+ schema = z32.object(
4017
4057
  field3.fields.reduce((acc, subfield) => {
4018
4058
  acc[subfield.id] = mapFieldTypeToZod(subfield, actionType);
4019
4059
  return acc;
@@ -4338,7 +4378,7 @@ var isNonInteractiveFieldType = (field3) => {
4338
4378
  var import_lodash3 = require("lodash");
4339
4379
 
4340
4380
  // ../commons/src/utils.ts
4341
- var z32 = __toESM(require("zod/v4"));
4381
+ var z33 = __toESM(require("zod/v4"));
4342
4382
  var _ = __toESM(require("lodash"));
4343
4383
  function getOrThrow(x, message) {
4344
4384
  if (x === void 0 || x === null) {
@@ -4349,11 +4389,11 @@ function getOrThrow(x, message) {
4349
4389
  function joinValues(values, separator = " ") {
4350
4390
  return values.filter((value) => !!value).join(separator).trim();
4351
4391
  }
4352
- var FullNameV1 = z32.array(
4353
- z32.object({
4354
- use: z32.string(),
4355
- family: z32.string(),
4356
- given: z32.array(z32.string())
4392
+ var FullNameV1 = z33.array(
4393
+ z33.object({
4394
+ use: z33.string(),
4395
+ family: z33.string(),
4396
+ given: z33.array(z33.string())
4357
4397
  })
4358
4398
  );
4359
4399
  function omitKeyDeep(obj, keyToRemove) {
@@ -5577,9 +5617,9 @@ var ajv = new import__.default({
5577
5617
  strict: false
5578
5618
  // Allow minContains and other newer features
5579
5619
  });
5580
- var DataContext = z33.object({
5581
- rootData: z33.object({
5582
- $leafAdminStructureLocationIds: z33.array(z33.object({ id: UUID }))
5620
+ var DataContext = z34.object({
5621
+ rootData: z34.object({
5622
+ $leafAdminStructureLocationIds: z34.array(z34.object({ id: UUID }))
5583
5623
  })
5584
5624
  });
5585
5625
  function resolveDataPath(rootData, dataPath, instancePath) {
@@ -5616,33 +5656,15 @@ function compileClientFunction(code) {
5616
5656
  return fn;
5617
5657
  }
5618
5658
  (0, import_ajv_formats.default)(ajv);
5619
- var inMemoryEventStateCache = /* @__PURE__ */ new WeakMap();
5620
- function getInMemoryEventState(event2, config) {
5621
- let stateByConfig = inMemoryEventStateCache.get(event2);
5622
- if (!stateByConfig) {
5623
- stateByConfig = /* @__PURE__ */ new WeakMap();
5624
- inMemoryEventStateCache.set(event2, stateByConfig);
5625
- }
5626
- let state = stateByConfig.get(config);
5627
- if (!state) {
5628
- state = getCurrentEventState(event2, config);
5629
- stateByConfig.set(config, state);
5630
- }
5631
- return state;
5632
- }
5633
5659
  function buildClientFunctionContext(input) {
5634
- const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getInMemoryEventState(
5635
- input.validatorContext?.event,
5636
- input.validatorContext?.eventConfig
5637
- )?.flags : [];
5638
5660
  return {
5639
5661
  $form: input.form,
5640
- $flags: flags,
5662
+ $flags: input.validatorContext?.event?.state.flags ?? [],
5641
5663
  $now: todayISO(),
5642
5664
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
5643
5665
  $online: isOnline(),
5644
5666
  $user: input.validatorContext?.user,
5645
- $event: input.validatorContext?.event,
5667
+ $event: input.validatorContext?.event?.document,
5646
5668
  $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
5647
5669
  user: input.systemVariables?.user,
5648
5670
  $window: input.systemVariables?.$window,
@@ -5823,6 +5845,9 @@ function isFieldSecured(field3, event2, context = {}) {
5823
5845
  };
5824
5846
  return validate(field3.secured, clientFunctionContext);
5825
5847
  }
5848
+ function getEventValidatorContext(document, config) {
5849
+ return { document, state: getCurrentEventState(document, config) };
5850
+ }
5826
5851
  function isFieldConditionMet(field3, form, conditionalType, context) {
5827
5852
  const hasRule = (field3.conditionals ?? []).some(
5828
5853
  (conditional) => conditional.type === conditionalType
@@ -6692,11 +6717,11 @@ function validateActionOrder(event2, ctx) {
6692
6717
  }
6693
6718
 
6694
6719
  // ../commons/src/events/EventConfig.ts
6695
- var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
6720
+ var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
6696
6721
  "Reference to a field defined in the event metadata, using the field id."
6697
6722
  );
6698
- var _EventConfigBase = z34.object({
6699
- id: z34.string().describe(
6723
+ var _EventConfigBase = z35.object({
6724
+ id: z35.string().describe(
6700
6725
  'Machine-readable identifier of the event (e.g. "birth", "death").'
6701
6726
  ),
6702
6727
  dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
@@ -6715,25 +6740,25 @@ var _EventConfigBase = z34.object({
6715
6740
  "Summary information displayed in the event overview."
6716
6741
  ),
6717
6742
  label: TranslationConfig.describe("Human-readable label for the event type."),
6718
- actions: z34.array(ActionConfig).describe(
6743
+ actions: z35.array(ActionConfig).describe(
6719
6744
  "Configuration of core and custom actions associated with the event."
6720
6745
  ),
6721
- actionOrder: z34.array(z34.string()).optional().describe(
6746
+ actionOrder: z35.array(z35.string()).optional().describe(
6722
6747
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
6723
6748
  ),
6724
6749
  declaration: DeclarationFormConfig.describe(
6725
6750
  "Configuration of the form used to gather event data."
6726
6751
  ),
6727
- advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
6752
+ advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
6728
6753
  "Configuration of fields available in the advanced search feature."
6729
6754
  ),
6730
- flags: z34.array(FlagConfig).optional().default([]).describe(
6755
+ flags: z35.array(FlagConfig).optional().default([]).describe(
6731
6756
  "Configuration of custom flags associated with the actions of this event type."
6732
6757
  ),
6733
- analytics: z34.boolean().optional().default(true).describe(
6758
+ analytics: z35.boolean().optional().default(true).describe(
6734
6759
  "Indicates whether the records of this event type are included in analytics"
6735
6760
  ),
6736
- icon: z34.partialRecord(AvailableIcons, Conditional).optional().describe(
6761
+ icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
6737
6762
  'Maps an icon name to a conditional. The icon of the first entry (in definition order) whose conditional matches the event is used when rendering it (e.g. in the "iconWithName"/"iconWithNameEvent" workqueue columns). Falls back to the default status-based icon when unset or when no conditional matches.'
6738
6763
  )
6739
6764
  });
@@ -6755,7 +6780,7 @@ var definePage = (page) => PageConfig.parse(page);
6755
6780
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
6756
6781
 
6757
6782
  // ../commons/src/events/WorkqueueConfig.ts
6758
- var z37 = __toESM(require("zod/v4"));
6783
+ var z38 = __toESM(require("zod/v4"));
6759
6784
 
6760
6785
  // ../commons/src/searchConfigs.ts
6761
6786
  function createSearchConfig(baseField) {
@@ -6966,17 +6991,17 @@ var event = Object.assign(eventFn, {
6966
6991
  });
6967
6992
 
6968
6993
  // ../commons/src/events/WorkqueueColumnConfig.ts
6969
- var z35 = __toESM(require("zod/v4"));
6994
+ var z36 = __toESM(require("zod/v4"));
6970
6995
  var WorkqueueColumnKeysArray = [
6971
6996
  ...EventMetadataKeysArray,
6972
6997
  "title",
6973
6998
  "outbox"
6974
6999
  ];
6975
- var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
6976
- var WorkqueueColumnValue = z35.object({
7000
+ var WorkqueueColumnKeys = z36.enum(WorkqueueColumnKeysArray);
7001
+ var WorkqueueColumnValue = z36.object({
6977
7002
  $event: WorkqueueColumnKeys
6978
7003
  });
6979
- var WorkqueueColumn = z35.object({
7004
+ var WorkqueueColumn = z36.object({
6980
7005
  label: TranslationConfig,
6981
7006
  value: WorkqueueColumnValue
6982
7007
  }).meta({
@@ -6990,51 +7015,51 @@ function defineWorkqueuesColumns(workqueueColumns) {
6990
7015
  }
6991
7016
 
6992
7017
  // ../commons/src/events/CountryConfigQueryInput.ts
6993
- var z36 = __toESM(require("zod/v4"));
6994
- var SerializableExact = z36.object({
6995
- type: z36.literal("exact"),
6996
- term: z36.union([z36.string(), SerializedUserField])
6997
- });
6998
- var SerializableWithin = z36.object({
6999
- type: z36.literal("within"),
7000
- location: z36.union([z36.string(), SerializedUserField])
7001
- });
7002
- var SerializedQueryExpression = z36.object({
7003
- eventType: z36.string(),
7004
- status: z36.optional(z36.union([AnyOfStatus, ExactStatus])),
7005
- createdAt: z36.optional(DateCondition),
7006
- updatedAt: z36.optional(DateCondition),
7007
- "legalStatuses.DECLARED.createdAtLocation": z36.optional(SerializableWithin),
7008
- "legalStatuses.DECLARED.createdByRole": z36.optional(AnyOf),
7009
- "legalStatuses.REGISTERED.createdAt": z36.optional(DateCondition),
7010
- "legalStatuses.REGISTERED.createdAtLocation": z36.optional(SerializableWithin),
7011
- "legalStatuses.REGISTERED.createdByRole": z36.optional(AnyOf),
7012
- "legalStatuses.REGISTERED.registrationNumber": z36.optional(Exact),
7013
- createdAtLocation: z36.optional(
7014
- z36.union([SerializableWithin, SerializableExact])
7018
+ var z37 = __toESM(require("zod/v4"));
7019
+ var SerializableExact = z37.object({
7020
+ type: z37.literal("exact"),
7021
+ term: z37.union([z37.string(), SerializedUserField])
7022
+ });
7023
+ var SerializableWithin = z37.object({
7024
+ type: z37.literal("within"),
7025
+ location: z37.union([z37.string(), SerializedUserField])
7026
+ });
7027
+ var SerializedQueryExpression = z37.object({
7028
+ eventType: z37.string(),
7029
+ status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
7030
+ createdAt: z37.optional(DateCondition),
7031
+ updatedAt: z37.optional(DateCondition),
7032
+ "legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
7033
+ "legalStatuses.DECLARED.createdByRole": z37.optional(AnyOf),
7034
+ "legalStatuses.REGISTERED.createdAt": z37.optional(DateCondition),
7035
+ "legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
7036
+ "legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
7037
+ "legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
7038
+ createdAtLocation: z37.optional(
7039
+ z37.union([SerializableWithin, SerializableExact])
7015
7040
  ),
7016
- updatedAtLocation: z36.optional(
7017
- z36.union([SerializableWithin, SerializableExact])
7041
+ updatedAtLocation: z37.optional(
7042
+ z37.union([SerializableWithin, SerializableExact])
7018
7043
  ),
7019
- updatedByUserRole: z36.optional(SerializableExact),
7020
- assignedTo: z36.optional(SerializableExact),
7021
- createdBy: z36.optional(SerializableExact),
7044
+ updatedByUserRole: z37.optional(SerializableExact),
7045
+ assignedTo: z37.optional(SerializableExact),
7046
+ createdBy: z37.optional(SerializableExact),
7022
7047
  createdByUserType: ExactUserType,
7023
- updatedBy: z36.optional(SerializableExact),
7024
- trackingId: z36.optional(Exact),
7025
- flags: z36.optional(ContainsFlags),
7048
+ updatedBy: z37.optional(SerializableExact),
7049
+ trackingId: z37.optional(Exact),
7050
+ flags: z37.optional(ContainsFlags),
7026
7051
  data: QueryInput
7027
7052
  }).partial();
7028
- var Or2 = z36.object({
7029
- type: z36.literal("or"),
7030
- clauses: z36.array(SerializedQueryExpression)
7053
+ var Or2 = z37.object({
7054
+ type: z37.literal("or"),
7055
+ clauses: z37.array(SerializedQueryExpression)
7031
7056
  });
7032
- var And2 = z36.object({
7033
- type: z36.literal("and"),
7034
- clauses: z36.array(SerializedQueryExpression)
7057
+ var And2 = z37.object({
7058
+ type: z37.literal("and"),
7059
+ clauses: z37.array(SerializedQueryExpression)
7035
7060
  });
7036
- var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
7037
- var CountryConfigQueryInputType = z36.union([
7061
+ var CountryConfigQueryType = z37.discriminatedUnion("type", [And2, Or2]);
7062
+ var CountryConfigQueryInputType = z37.union([
7038
7063
  SerializedQueryExpression,
7039
7064
  And2,
7040
7065
  Or2
@@ -7059,16 +7084,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
7059
7084
  value: event.field("updatedAt")
7060
7085
  }
7061
7086
  ]);
7062
- var WorkqueueConfig = z37.object({
7063
- slug: z37.string().describe("Determines the url of the workqueue."),
7087
+ var WorkqueueConfig = z38.object({
7088
+ slug: z38.string().describe("Determines the url of the workqueue."),
7064
7089
  name: TranslationConfig.describe(
7065
7090
  "Title of the workflow (both in navigation and on the page)"
7066
7091
  ),
7067
7092
  query: CountryConfigQueryType,
7068
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
7093
+ action: z38.object({ type: WorkqueueActionType }).optional().describe(
7069
7094
  "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
7070
7095
  ),
7071
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
7096
+ columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
7072
7097
  icon: AvailableIcons,
7073
7098
  emptyMessage: TranslationConfig.optional()
7074
7099
  }).describe("Configuration for workqueue.");
@@ -7103,10 +7128,10 @@ function defineWorkqueues(workqueues) {
7103
7128
  workqueues.forEach(warnOnConfigurationIssues);
7104
7129
  return workqueues.map((workqueue) => defineWorkqueue(workqueue));
7105
7130
  }
7106
- var WorkqueueCountInput = z37.array(
7107
- z37.object({ slug: z37.string(), query: QueryType })
7131
+ var WorkqueueCountInput = z38.array(
7132
+ z38.object({ slug: z38.string(), query: QueryType })
7108
7133
  );
7109
- var WorkqueueCountOutput = z37.record(z37.string(), z37.number());
7134
+ var WorkqueueCountOutput = z38.record(z38.string(), z38.number());
7110
7135
 
7111
7136
  // ../commons/src/events/workqueueDefaultColumns.ts
7112
7137
  var defaultWorkqueueColumns = [
@@ -7129,21 +7154,21 @@ var defaultWorkqueueColumns = [
7129
7154
  ];
7130
7155
 
7131
7156
  // ../commons/src/events/Draft.ts
7132
- var z39 = __toESM(require("zod/v4"));
7157
+ var z40 = __toESM(require("zod/v4"));
7133
7158
 
7134
7159
  // ../commons/src/events/ActionInput.ts
7135
- var z38 = __toESM(require("zod/v4"));
7136
- var BaseActionInput = z38.object({
7160
+ var z39 = __toESM(require("zod/v4"));
7161
+ var BaseActionInput = z39.object({
7137
7162
  eventId: UUID,
7138
- transactionId: z38.string(),
7163
+ transactionId: z39.string(),
7139
7164
  declaration: ActionUpdate.default({}),
7140
7165
  annotation: ActionUpdate.optional(),
7141
7166
  originalActionId: UUID.optional(),
7142
7167
  // should not be part of base action.
7143
- keepAssignment: z38.boolean().optional(),
7144
- keepAssignmentIfAccepted: z38.boolean().optional(),
7145
- keepAssignmentIfRejected: z38.boolean().optional(),
7146
- waitFor: z38.boolean().default(true).describe(
7168
+ keepAssignment: z39.boolean().optional(),
7169
+ keepAssignmentIfAccepted: z39.boolean().optional(),
7170
+ keepAssignmentIfRejected: z39.boolean().optional(),
7171
+ waitFor: z39.boolean().default(true).describe(
7147
7172
  "Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
7148
7173
  ),
7149
7174
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
@@ -7153,8 +7178,8 @@ var BaseActionInput = z38.object({
7153
7178
  )
7154
7179
  });
7155
7180
  var CreateActionInput = BaseActionInput.extend(
7156
- z38.object({
7157
- type: z38.literal(ActionType.CREATE).default(ActionType.CREATE),
7181
+ z39.object({
7182
+ type: z39.literal(ActionType.CREATE).default(ActionType.CREATE),
7158
7183
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
7159
7184
  createdAtLocation: UUID.nullish().describe(
7160
7185
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
@@ -7162,14 +7187,14 @@ var CreateActionInput = BaseActionInput.extend(
7162
7187
  }).shape
7163
7188
  );
7164
7189
  var RegisterActionInput = BaseActionInput.extend(
7165
- z38.strictObject({
7166
- type: z38.literal(ActionType.REGISTER).default(ActionType.REGISTER),
7167
- registrationNumber: z38.string().optional()
7190
+ z39.strictObject({
7191
+ type: z39.literal(ActionType.REGISTER).default(ActionType.REGISTER),
7192
+ registrationNumber: z39.string().optional()
7168
7193
  }).shape
7169
7194
  );
7170
7195
  var NotifyActionInput = BaseActionInput.extend(
7171
- z38.object({
7172
- type: z38.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
7196
+ z39.object({
7197
+ type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
7173
7198
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
7174
7199
  createdAtLocation: UUID.nullish().describe(
7175
7200
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
@@ -7185,103 +7210,107 @@ var NotifyActionInput = BaseActionInput.extend(
7185
7210
  }
7186
7211
  });
7187
7212
  var DeclareActionInput = BaseActionInput.extend(
7188
- z38.object({
7189
- type: z38.literal(ActionType.DECLARE).default(ActionType.DECLARE)
7213
+ z39.object({
7214
+ type: z39.literal(ActionType.DECLARE).default(ActionType.DECLARE)
7190
7215
  }).shape
7191
7216
  );
7192
7217
  var EditActionInput = BaseActionInput.extend(
7193
- z38.object({
7194
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
7218
+ z39.object({
7219
+ type: z39.literal(ActionType.EDIT).default(ActionType.EDIT)
7195
7220
  }).shape
7196
7221
  );
7197
7222
  var PrintCertificateActionInput = BaseActionInput.extend(
7198
- z38.object({
7199
- type: z38.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
7223
+ z39.object({
7224
+ type: z39.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
7200
7225
  content: PrintContent.optional()
7201
7226
  }).shape
7202
7227
  );
7203
7228
  var RejectDeclarationActionInput = BaseActionInput.extend(
7204
- z38.object({
7205
- type: z38.literal(ActionType.REJECT).default(ActionType.REJECT),
7229
+ z39.object({
7230
+ type: z39.literal(ActionType.REJECT).default(ActionType.REJECT),
7206
7231
  content: ReasonContent
7207
7232
  }).shape
7208
7233
  );
7209
7234
  var DuplicateDetectedActionInput = BaseActionInput.extend(
7210
- z38.object({
7211
- type: z38.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
7212
- content: z38.object({
7213
- duplicates: z38.array(PotentialDuplicate)
7235
+ z39.object({
7236
+ type: z39.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
7237
+ content: z39.object({
7238
+ duplicates: z39.array(PotentialDuplicate)
7214
7239
  })
7215
7240
  }).shape
7216
7241
  );
7217
7242
  var MarkAsDuplicateActionInput = BaseActionInput.extend(
7218
- z38.object({
7219
- type: z38.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
7220
- content: z38.object({
7243
+ z39.object({
7244
+ type: z39.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
7245
+ content: z39.object({
7221
7246
  duplicateOf: UUID
7222
7247
  }).optional()
7223
7248
  }).shape
7224
7249
  );
7225
7250
  var MarkNotDuplicateActionInput = BaseActionInput.extend(
7226
- z38.object({
7227
- type: z38.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
7251
+ z39.object({
7252
+ type: z39.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
7228
7253
  }).shape
7229
7254
  );
7230
7255
  var ArchiveActionInput = BaseActionInput.extend(
7231
- z38.object({
7232
- type: z38.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
7233
- content: ReasonContent
7256
+ z39.object({
7257
+ type: z39.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
7258
+ /**
7259
+ * Archiving does not collect a reason on its own. Only the
7260
+ * "mark as duplicate" flow archives with a reason attached.
7261
+ */
7262
+ content: ReasonContent.optional()
7234
7263
  }).shape
7235
7264
  );
7236
7265
  var UnarchiveActionInput = BaseActionInput.extend(
7237
- z38.object({
7238
- type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
7266
+ z39.object({
7267
+ type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
7239
7268
  }).shape
7240
7269
  );
7241
7270
  var AssignActionInput = BaseActionInput.extend(
7242
- z38.object({
7243
- type: z38.literal(ActionType.ASSIGN),
7244
- assignedTo: z38.string()
7271
+ z39.object({
7272
+ type: z39.literal(ActionType.ASSIGN),
7273
+ assignedTo: z39.string()
7245
7274
  }).shape
7246
7275
  );
7247
7276
  var UnassignActionInput = BaseActionInput.extend(
7248
- z38.object({
7249
- type: z38.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
7250
- assignedTo: z38.literal(null).default(null)
7277
+ z39.object({
7278
+ type: z39.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
7279
+ assignedTo: z39.literal(null).default(null)
7251
7280
  }).shape
7252
7281
  );
7253
7282
  var RequestCorrectionActionInput = BaseActionInput.extend(
7254
- z38.object({
7255
- type: z38.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
7283
+ z39.object({
7284
+ type: z39.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
7256
7285
  }).shape
7257
7286
  );
7258
7287
  var RejectCorrectionActionInput = BaseActionInput.extend(
7259
- z38.object({
7260
- requestId: z38.string(),
7261
- type: z38.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
7288
+ z39.object({
7289
+ requestId: z39.string(),
7290
+ type: z39.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
7262
7291
  content: ReasonContent
7263
7292
  }).shape
7264
7293
  );
7265
7294
  var ApproveCorrectionActionInput = BaseActionInput.extend(
7266
- z38.object({
7267
- requestId: z38.string(),
7268
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
7269
- content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
7295
+ z39.object({
7296
+ requestId: z39.string(),
7297
+ type: z39.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
7298
+ content: z39.object({ immediateCorrection: z39.boolean().optional() }).optional()
7270
7299
  }).shape
7271
7300
  );
7272
7301
  var ReadActionInput = BaseActionInput.extend(
7273
- z38.object({
7274
- type: z38.literal(ActionType.READ).default(ActionType.READ)
7302
+ z39.object({
7303
+ type: z39.literal(ActionType.READ).default(ActionType.READ)
7275
7304
  }).shape
7276
7305
  );
7277
- var DeleteActionInput = z38.object({ eventId: UUID });
7306
+ var DeleteActionInput = z39.object({ eventId: UUID });
7278
7307
  var CustomActionInput = BaseActionInput.extend(
7279
- z38.object({
7280
- type: z38.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
7281
- customActionType: z38.string().describe("Name of the custom action.")
7308
+ z39.object({
7309
+ type: z39.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
7310
+ customActionType: z39.string().describe("Name of the custom action.")
7282
7311
  }).shape
7283
7312
  );
7284
- var ActionInput = z38.discriminatedUnion("type", [
7313
+ var ActionInput = z39.discriminatedUnion("type", [
7285
7314
  CreateActionInput.meta({ id: "CreateActionInput" }),
7286
7315
  RegisterActionInput.meta({ id: "RegisterActionInput" }),
7287
7316
  NotifyActionInput.meta({ id: "NotifyActionInput" }),
@@ -7318,11 +7347,11 @@ var ActionInput = z38.discriminatedUnion("type", [
7318
7347
  });
7319
7348
 
7320
7349
  // ../commons/src/events/Draft.ts
7321
- var Draft = z39.object({
7350
+ var Draft = z40.object({
7322
7351
  id: UUID,
7323
7352
  eventId: UUID,
7324
- transactionId: z39.string(),
7325
- createdAt: z39.string().datetime(),
7353
+ transactionId: z40.string(),
7354
+ createdAt: z40.string().datetime(),
7326
7355
  action: ActionBase.extend({
7327
7356
  type: ActionTypes.exclude([ActionTypes.enum.DELETE])
7328
7357
  }).omit({ id: true, createdAtLocation: true })
@@ -7331,7 +7360,7 @@ var Draft = z39.object({
7331
7360
  );
7332
7361
  var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
7333
7362
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
7334
- status: z39.enum([
7363
+ status: z40.enum([
7335
7364
  ActionStatus.Requested,
7336
7365
  ActionStatus.Accepted,
7337
7366
  ActionStatus.Rejected
@@ -7339,30 +7368,33 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
7339
7368
  });
7340
7369
 
7341
7370
  // ../commons/src/events/EventInput.ts
7342
- var z40 = __toESM(require("zod/v4"));
7371
+ var z41 = __toESM(require("zod/v4"));
7343
7372
  var import_uuid11 = require("uuid");
7344
- var EventInput = z40.object({
7345
- transactionId: z40.string(),
7346
- type: z40.string(),
7373
+ var EventInput = z41.object({
7374
+ transactionId: z41.string(),
7375
+ type: z41.string(),
7347
7376
  createdAtLocation: UUID.nullish().describe(
7348
7377
  "Location where the event occurred. Required for system users."
7349
7378
  )
7350
7379
  }).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
7351
7380
 
7352
7381
  // ../commons/src/events/EventDocument.ts
7353
- var z41 = __toESM(require("zod/v4"));
7354
- var EventDocument = z41.object({
7382
+ var z42 = __toESM(require("zod/v4"));
7383
+ var EventDocument = z42.object({
7355
7384
  id: UUID.describe("Unique identifier of the event."),
7356
- type: z41.string().describe("Type of the event (e.g. birth, death, marriage)."),
7357
- createdAt: z41.string().datetime().describe("Timestamp indicating when the event was created."),
7358
- updatedAt: z41.string().datetime().describe(
7385
+ type: z42.string().describe("Type of the event (e.g. birth, death, marriage)."),
7386
+ createdAt: z42.string().datetime().describe("Timestamp indicating when the event was created."),
7387
+ updatedAt: z42.string().datetime().describe(
7359
7388
  "Timestamp of the last update, excluding changes from actions."
7360
7389
  ),
7361
- actions: z41.array(Action).describe("Ordered list of actions associated with the event."),
7362
- trackingId: z41.string().describe(
7390
+ actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
7391
+ trackingId: z42.string().describe(
7363
7392
  "System-generated tracking identifier used to look up the event."
7364
7393
  )
7365
7394
  }).meta({ id: "EventDocument" });
7395
+ var EventDocumentOnlyLastAction = EventDocument.extend({
7396
+ actions: z42.array(Action).max(1).describe("Only the last action associated with the event.")
7397
+ }).brand("EventDocumentOnlyLastAction");
7366
7398
 
7367
7399
  // ../commons/src/events/defineConfig.ts
7368
7400
  var IGNORED_EVENT_TYPES = [
@@ -9821,9 +9853,9 @@ var digitalIdentityEvent = defineConfig({
9821
9853
  });
9822
9854
 
9823
9855
  // ../commons/src/events/test.utils.ts
9824
- var z42 = __toESM(require("zod/v4"));
9856
+ var z43 = __toESM(require("zod/v4"));
9825
9857
  var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
9826
- var TestUserRole = z42.enum([
9858
+ var TestUserRole = z43.enum([
9827
9859
  "FIELD_AGENT",
9828
9860
  "LOCAL_REGISTRAR",
9829
9861
  "LOCAL_SYSTEM_ADMIN",
@@ -9893,6 +9925,16 @@ function generateRegistrationNumber(rng) {
9893
9925
  function generateRandomSignature(rng) {
9894
9926
  return `${generateUuid(rng)}.png`;
9895
9927
  }
9928
+ function locationVersion(overrides = {}, rng) {
9929
+ return {
9930
+ versionId: generateUuid(rng),
9931
+ effectiveFrom: "0001-01-01",
9932
+ name: "Location name",
9933
+ externalId: null,
9934
+ status: "active",
9935
+ ...overrides
9936
+ };
9937
+ }
9896
9938
  function mapFieldTypeToMockValue(field3, i, rng, administrativeHierarchy) {
9897
9939
  const leafLevelAdministrativeAreas = administrativeHierarchy?.administrativeAreas.filter(
9898
9940
  (aa) => administrativeHierarchy?.administrativeAreas.every(
@@ -10208,9 +10250,6 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
10208
10250
  declaration: {},
10209
10251
  annotation: {},
10210
10252
  eventId,
10211
- content: {
10212
- reason: `${ActionType.ARCHIVE}`
10213
- },
10214
10253
  ...input
10215
10254
  }),
10216
10255
  unarchive: (eventId, input = {}) => ({
@@ -10681,36 +10720,36 @@ function isFieldConfigDefaultValue(value) {
10681
10720
  var import_lodash6 = require("lodash");
10682
10721
 
10683
10722
  // ../commons/src/events/locations.ts
10684
- var z43 = __toESM(require("zod/v4"));
10685
- var LocationTypeV1 = z43.enum([
10723
+ var z44 = __toESM(require("zod/v4"));
10724
+ var LocationTypeV1 = z44.enum([
10686
10725
  "ADMIN_STRUCTURE",
10687
10726
  "CRVS_OFFICE",
10688
10727
  "HEALTH_FACILITY"
10689
10728
  ]);
10690
- var LocationStatus = z43.enum(["active", "inactive"]);
10691
- var LocationVersion = z43.object({
10729
+ var LocationStatus = z44.enum(["active", "inactive"]);
10730
+ var LocationVersion = z44.object({
10692
10731
  versionId: UUID,
10693
- effectiveFrom: z43.iso.date(),
10694
- name: z43.string(),
10695
- externalId: z43.string().nullish(),
10732
+ effectiveFrom: z44.iso.date(),
10733
+ name: z44.string(),
10734
+ externalId: z44.string().nullish(),
10696
10735
  status: LocationStatus
10697
10736
  });
10698
- var AdministrativeArea = z43.object({
10737
+ var AdministrativeArea = z44.object({
10699
10738
  id: UUID,
10700
- name: z43.string(),
10701
- externalId: z43.string().nullish(),
10739
+ name: z44.string(),
10740
+ externalId: z44.string().nullish(),
10702
10741
  parentId: UUID.nullable(),
10703
10742
  status: LocationStatus,
10704
- versions: z43.array(LocationVersion)
10743
+ versions: z44.array(LocationVersion)
10705
10744
  });
10706
- var Location = z43.object({
10745
+ var Location = z44.object({
10707
10746
  id: UUID,
10708
- name: z43.string(),
10709
- externalId: z43.string().nullish(),
10747
+ name: z44.string(),
10748
+ externalId: z44.string().nullish(),
10710
10749
  administrativeAreaId: UUID.nullable(),
10711
- locationType: z43.string().nullable(),
10750
+ locationType: z44.string().nullable(),
10712
10751
  status: LocationStatus,
10713
- versions: z43.array(LocationVersion)
10752
+ versions: z44.array(LocationVersion)
10714
10753
  });
10715
10754
  var ClientAdministrativeArea = AdministrativeArea.omit({
10716
10755
  name: true,
@@ -10737,18 +10776,38 @@ function toClientAdministrativeArea(area) {
10737
10776
  versions: area.versions
10738
10777
  };
10739
10778
  }
10740
- var SetLocationPayload = z43.object({
10779
+ function validateAscendingDates(versions, ctx) {
10780
+ const ascending = versions.every(
10781
+ (version, index) => index === 0 || versions[index - 1].effectiveFrom < version.effectiveFrom
10782
+ );
10783
+ if (!ascending) {
10784
+ ctx.addIssue("versions must be strictly ascending by effectiveFrom");
10785
+ }
10786
+ }
10787
+ function validateUniqueIds(versions, ctx) {
10788
+ const versionIds = new Set(versions.map((version) => version.versionId));
10789
+ if (versionIds.size !== versions.length) {
10790
+ ctx.addIssue("versions must not repeat a versionId");
10791
+ }
10792
+ }
10793
+ var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
10794
+ validateAscendingDates(versions, ctx);
10795
+ validateUniqueIds(versions, ctx);
10796
+ });
10797
+ var SetLocationPayload = z44.object({
10741
10798
  id: UUID,
10742
- name: z43.string(),
10743
- externalId: z43.string().nullish(),
10799
+ name: z44.string(),
10800
+ externalId: z44.string().nullish(),
10744
10801
  administrativeAreaId: UUID.nullable(),
10745
- locationType: z43.string().nullable()
10802
+ locationType: z44.string().nullable(),
10803
+ versions: SeededLocationVersions.optional()
10746
10804
  });
10747
- var SetAdministrativeAreaPayload = z43.object({
10805
+ var SetAdministrativeAreaPayload = z44.object({
10748
10806
  id: UUID,
10749
- name: z43.string(),
10750
- externalId: z43.string().nullish(),
10751
- parentId: UUID.nullable()
10807
+ name: z44.string(),
10808
+ externalId: z44.string().nullish(),
10809
+ parentId: UUID.nullable(),
10810
+ versions: SeededLocationVersions.optional()
10752
10811
  });
10753
10812
  function resolveVersion(versions, anchor) {
10754
10813
  let resolved = versions[0];
@@ -10759,6 +10818,9 @@ function resolveVersion(versions, anchor) {
10759
10818
  }
10760
10819
  return resolved;
10761
10820
  }
10821
+ function isSelectableAtAnchor(versions, anchor) {
10822
+ return versions.some((version) => version.effectiveFrom <= anchor) && resolveVersion(versions, anchor).status === "active";
10823
+ }
10762
10824
  function hasActiveExternalIdOnOrAfter(versions, externalId, anchor) {
10763
10825
  const inEffectAtAnchor = resolveVersion(versions, anchor);
10764
10826
  const laterVersions = versions.filter((v) => v.effectiveFrom > anchor);
@@ -10814,6 +10876,9 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
10814
10876
  }
10815
10877
  if (scopeUsesDeclaredOptions(scope)) {
10816
10878
  const { options } = scope;
10879
+ if (options?.status && (!event2.status || !options.status.includes(event2.status))) {
10880
+ return false;
10881
+ }
10817
10882
  if (options?.notifiedBy === UserFilter.enum.user) {
10818
10883
  if (event2.legalStatuses?.NOTIFIED?.createdBy !== user2.id) {
10819
10884
  return false;
@@ -11166,8 +11231,7 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
11166
11231
  ActionType.READ,
11167
11232
  ActionType.DECLARE,
11168
11233
  ActionType.NOTIFY,
11169
- ActionType.DELETE,
11170
- ActionType.CUSTOM
11234
+ ActionType.DELETE
11171
11235
  ],
11172
11236
  [EventStatus.enum.NOTIFIED]: [
11173
11237
  ActionType.READ,
@@ -11613,49 +11677,49 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
11613
11677
  );
11614
11678
 
11615
11679
  // ../commons/src/events/locationPayloads.ts
11616
- var z44 = __toESM(require("zod/v4"));
11617
- var CreateLocationPayload = z44.object({
11680
+ var z45 = __toESM(require("zod/v4"));
11681
+ var CreateLocationPayload = z45.object({
11618
11682
  id: UUID.optional(),
11619
11683
  versionId: UUID.optional(),
11620
- name: z44.string(),
11621
- externalId: z44.string().nullish(),
11684
+ name: z45.string(),
11685
+ externalId: z45.string().nullish(),
11622
11686
  administrativeAreaId: UUID.nullable(),
11623
- locationType: z44.string().nullable(),
11624
- effectiveFrom: z44.iso.date().optional(),
11687
+ locationType: z45.string().nullable(),
11688
+ effectiveFrom: z45.iso.date().optional(),
11625
11689
  status: LocationStatus.default("active")
11626
11690
  });
11627
- var UpdateLocationPayload = z44.strictObject({
11691
+ var UpdateLocationPayload = z45.strictObject({
11628
11692
  id: UUID,
11629
11693
  versionId: UUID.optional(),
11630
- name: z44.string(),
11631
- externalId: z44.string().nullish(),
11694
+ name: z45.string(),
11695
+ externalId: z45.string().nullish(),
11632
11696
  status: LocationStatus,
11633
- effectiveFrom: z44.iso.date().optional(),
11697
+ effectiveFrom: z45.iso.date().optional(),
11634
11698
  lastVersionId: UUID
11635
11699
  });
11636
- var WithdrawLocationVersionPayload = z44.object({
11700
+ var WithdrawLocationVersionPayload = z45.object({
11637
11701
  id: UUID,
11638
11702
  versionId: UUID
11639
11703
  });
11640
- var CreateAdministrativeAreaPayload = z44.object({
11704
+ var CreateAdministrativeAreaPayload = z45.object({
11641
11705
  id: UUID.optional(),
11642
11706
  versionId: UUID.optional(),
11643
- name: z44.string(),
11644
- externalId: z44.string().nullish(),
11707
+ name: z45.string(),
11708
+ externalId: z45.string().nullish(),
11645
11709
  parentId: UUID.nullable(),
11646
- effectiveFrom: z44.iso.date().optional(),
11710
+ effectiveFrom: z45.iso.date().optional(),
11647
11711
  status: LocationStatus.default("active")
11648
11712
  });
11649
- var UpdateAdministrativeAreaPayload = z44.strictObject({
11713
+ var UpdateAdministrativeAreaPayload = z45.strictObject({
11650
11714
  id: UUID,
11651
11715
  versionId: UUID.optional(),
11652
- name: z44.string(),
11653
- externalId: z44.string().nullish(),
11716
+ name: z45.string(),
11717
+ externalId: z45.string().nullish(),
11654
11718
  status: LocationStatus,
11655
- effectiveFrom: z44.iso.date().optional(),
11719
+ effectiveFrom: z45.iso.date().optional(),
11656
11720
  lastVersionId: UUID
11657
11721
  });
11658
- var WithdrawAdministrativeAreaVersionPayload = z44.object({
11722
+ var WithdrawAdministrativeAreaVersionPayload = z45.object({
11659
11723
  id: UUID,
11660
11724
  versionId: UUID
11661
11725
  });