@opencrvs/toolkit 2.1.0-rc.d7bd264 → 2.1.0-rc.d876831

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/README.md +1 -0
  2. package/dist/application-config/index.js +30 -9
  3. package/dist/cli.js +174 -58
  4. package/dist/commons/api/router.d.ts +269 -11
  5. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  6. package/dist/commons/conditionals/validate.d.ts +9 -3
  7. package/dist/commons/events/ActionConfig.d.ts +0 -21
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
  9. package/dist/commons/events/AuditLog.d.ts +147 -0
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -18
  11. package/dist/commons/events/EventConfig.d.ts +3 -0
  12. package/dist/commons/events/EventIndex.d.ts +2 -6
  13. package/dist/commons/events/EventMetadata.d.ts +0 -1
  14. package/dist/commons/events/FieldConfig.d.ts +65 -53
  15. package/dist/commons/events/FieldValue.d.ts +2 -2
  16. package/dist/commons/events/Flag.d.ts +0 -6
  17. package/dist/commons/events/PlainDate.d.ts +8 -0
  18. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  19. package/dist/commons/events/WorkqueueConfig.d.ts +5 -17
  20. package/dist/commons/events/event.d.ts +12 -0
  21. package/dist/commons/events/index.d.ts +1 -0
  22. package/dist/commons/events/locationPayloads.d.ts +95 -0
  23. package/dist/commons/events/locations.d.ts +106 -16
  24. package/dist/commons/events/mocks.test.utils.d.ts +30 -0
  25. package/dist/conditionals/index.js +2 -2
  26. package/dist/environment/index.d.ts +1 -0
  27. package/dist/environment/index.d.ts.map +1 -1
  28. package/dist/environment/index.js +10 -0
  29. package/dist/environment/logger.d.ts +12 -3
  30. package/dist/environment/logger.d.ts.map +1 -1
  31. package/dist/environment/paths.d.ts +7 -0
  32. package/dist/environment/paths.d.ts.map +1 -0
  33. package/dist/environment/paths.js +72 -0
  34. package/dist/environment/setup-environment.js +2 -1
  35. package/dist/environment/templates.d.ts.map +1 -1
  36. package/dist/environment/templates.js +2 -1
  37. package/dist/environment/update-workflows.d.ts.map +1 -1
  38. package/dist/environment/update-workflows.js +17 -5
  39. package/dist/environment/upgrade.d.ts +2 -0
  40. package/dist/environment/upgrade.d.ts.map +1 -0
  41. package/dist/environment/upgrade.js +82 -0
  42. package/dist/environment/users.js +11 -13
  43. package/dist/events/index.js +502 -211
  44. package/dist/notification/index.js +529 -262
  45. package/dist/scopes/index.d.ts +28 -53
  46. package/dist/scopes/index.js +2 -2
  47. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  48. package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
  49. package/opencrvs-toolkit-2.1.0-rc.d876831.tgz +0 -0
  50. package/package.json +5 -4
  51. package/tsconfig.tsbuildinfo +1 -1
  52. package/opencrvs-toolkit-2.1.0-rc.d7bd264.tgz +0 -0
@@ -74,12 +74,16 @@ __export(events_exports, {
74
74
  CertificateTemplateConfig: () => CertificateTemplateConfig,
75
75
  CheckboxFieldValue: () => CheckboxFieldValue,
76
76
  Clause: () => Clause,
77
+ ClientAdministrativeArea: () => ClientAdministrativeArea,
78
+ ClientLocation: () => ClientLocation,
77
79
  ClientSpecificAction: () => ClientSpecificAction,
78
80
  ComputedDefaultValue: () => ComputedDefaultValue,
79
81
  Conditional: () => Conditional,
80
82
  ConditionalType: () => ConditionalType,
81
83
  ConfirmableActions: () => ConfirmableActions,
82
84
  ContainsFlags: () => ContainsFlags,
85
+ CreateAdministrativeAreaPayload: () => CreateAdministrativeAreaPayload,
86
+ CreateLocationPayload: () => CreateLocationPayload,
83
87
  CustomActionInput: () => CustomActionInput,
84
88
  CustomFieldValue: () => CustomFieldValue,
85
89
  CustomFlag: () => CustomFlag,
@@ -157,6 +161,7 @@ __export(events_exports, {
157
161
  HttpFieldValue: () => HttpFieldValue,
158
162
  IdReaderFieldValue: () => IdReaderFieldValue,
159
163
  ImageMimeType: () => ImageMimeType,
164
+ InfoBox: () => InfoBox,
160
165
  InherentFlags: () => InherentFlags,
161
166
  LanguageConfig: () => LanguageConfig,
162
167
  LegalStatuses: () => LegalStatuses,
@@ -220,15 +225,21 @@ __export(events_exports, {
220
225
  UUID: () => UUID,
221
226
  UnarchiveActionInput: () => UnarchiveActionInput,
222
227
  UnassignActionInput: () => UnassignActionInput,
228
+ UpdateAdministrativeAreaPayload: () => UpdateAdministrativeAreaPayload,
229
+ UpdateLocationPayload: () => UpdateLocationPayload,
223
230
  UserAuditRecordInput: () => UserAuditRecordInput,
224
231
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
225
232
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP,
233
+ V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP,
234
+ V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP: () => V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP,
226
235
  V2_DEFAULT_MOCK_LOCATIONS: () => V2_DEFAULT_MOCK_LOCATIONS,
227
236
  V2_DEFAULT_MOCK_LOCATIONS_MAP: () => V2_DEFAULT_MOCK_LOCATIONS_MAP,
228
237
  ValidationConfig: () => ValidationConfig,
229
238
  VerificationActionConfig: () => VerificationActionConfig,
230
239
  VerificationPageConfig: () => VerificationPageConfig,
231
240
  VerificationStatusValue: () => VerificationStatusValue,
241
+ WithdrawAdministrativeAreaVersionPayload: () => WithdrawAdministrativeAreaVersionPayload,
242
+ WithdrawLocationVersionPayload: () => WithdrawLocationVersionPayload,
232
243
  Within: () => Within,
233
244
  WorkqueueActionType: () => WorkqueueActionType,
234
245
  WorkqueueColumn: () => WorkqueueColumn,
@@ -347,6 +358,7 @@ __export(events_exports, {
347
358
  getStatusFromActions: () => getStatusFromActions,
348
359
  getValidatorsForField: () => getValidatorsForField,
349
360
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
361
+ hasActiveExternalIdOnOrAfter: () => hasActiveExternalIdOnOrAfter,
350
362
  hasAnyOfScopes: () => hasAnyOfScopes,
351
363
  isActionAvailable: () => isActionAvailable,
352
364
  isActionConfigType: () => isActionConfigType,
@@ -376,6 +388,7 @@ __export(events_exports, {
376
388
  isFieldEnabled: () => isFieldEnabled,
377
389
  isFieldGroupFieldType: () => isFieldGroupFieldType,
378
390
  isFieldReference: () => isFieldReference,
391
+ isFieldSecured: () => isFieldSecured,
379
392
  isFieldValue: () => isFieldValue,
380
393
  isFieldValueWithoutTemplates: () => isFieldValueWithoutTemplates,
381
394
  isFieldVisible: () => isFieldVisible,
@@ -436,6 +449,7 @@ __export(events_exports, {
436
449
  precompileActionSchemas: () => precompileActionSchemas,
437
450
  resolveDateOfEvent: () => resolveDateOfEvent,
438
451
  resolveEventCustomFlags: () => resolveEventCustomFlags,
452
+ resolvePath: () => resolvePath,
439
453
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
440
454
  resolveVersion: () => resolveVersion,
441
455
  runClientFunction: () => runClientFunction,
@@ -444,6 +458,9 @@ __export(events_exports, {
444
458
  safeUnion: () => safeUnion,
445
459
  status: () => status,
446
460
  timePeriodToDateRange: () => timePeriodToDateRange,
461
+ toClientAdministrativeArea: () => toClientAdministrativeArea,
462
+ toClientLocation: () => toClientLocation,
463
+ toPlainDate: () => toPlainDate,
447
464
  todayISO: () => todayISO,
448
465
  user: () => user,
449
466
  userCanAccessEventWithScopes: () => userCanAccessEventWithScopes,
@@ -675,8 +692,7 @@ var InherentFlags = {
675
692
  *
676
693
  * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
677
694
  */
678
- EDIT_IN_PROGRESS: "edit-in-progress",
679
- SEALED: "sealed"
695
+ EDIT_IN_PROGRESS: "edit-in-progress"
680
696
  };
681
697
  var actionFlagPattern;
682
698
  function getActionFlagPattern() {
@@ -757,6 +773,7 @@ var PlainScopeType = z6.enum([
757
773
  "integration.create",
758
774
  "record.import",
759
775
  "config.update-all",
776
+ "location.edit",
760
777
  "attachment.upload",
761
778
  "profile.electronic-signature",
762
779
  "user.read-only-my-audit",
@@ -1127,6 +1144,82 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
1127
1144
  requestData: z8.object({ id: z8.string() }),
1128
1145
  responseSummary: z8.object({ clientId: z8.string() })
1129
1146
  });
1147
+ 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()
1154
+ };
1155
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
1156
+ operation: z8.literal("locations.create"),
1157
+ requestData: z8.object({
1158
+ ...createdVersionFields,
1159
+ administrativeAreaId: z8.string().nullish(),
1160
+ locationType: z8.string().nullish()
1161
+ })
1162
+ });
1163
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
1164
+ operation: z8.literal("administrativeAreas.create"),
1165
+ requestData: z8.object({
1166
+ ...createdVersionFields,
1167
+ parentId: z8.string().nullish()
1168
+ })
1169
+ });
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({
1188
+ name: ChangedStringField.optional(),
1189
+ externalId: ChangedNullableStringField.optional(),
1190
+ status: ChangedStringField.optional()
1191
+ })
1192
+ });
1193
+ var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
1194
+ operation: z8.literal("locations.update"),
1195
+ requestData: updatedVersionRequestData,
1196
+ responseSummary: updatedVersionResponseSummary
1197
+ });
1198
+ var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
1199
+ operation: z8.literal("administrativeAreas.update"),
1200
+ requestData: updatedVersionRequestData,
1201
+ responseSummary: updatedVersionResponseSummary
1202
+ });
1203
+ var withdrawVersionRequestData = z8.object({
1204
+ id: z8.string(),
1205
+ versionId: z8.string()
1206
+ });
1207
+ var withdrawVersionResponseSummary = z8.object({
1208
+ effectiveFrom: z8.string(),
1209
+ name: z8.string(),
1210
+ externalId: z8.string().nullish(),
1211
+ status: z8.string()
1212
+ });
1213
+ var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
1214
+ operation: z8.literal("locations.withdrawVersion"),
1215
+ requestData: withdrawVersionRequestData,
1216
+ responseSummary: withdrawVersionResponseSummary
1217
+ });
1218
+ var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
1219
+ operation: z8.literal("administrativeAreas.withdrawVersion"),
1220
+ requestData: withdrawVersionRequestData,
1221
+ responseSummary: withdrawVersionResponseSummary
1222
+ });
1130
1223
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
1131
1224
  operation: z8.literal("attachments.upload"),
1132
1225
  requestData: z8.object({
@@ -1202,6 +1295,12 @@ var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
1202
1295
  IntegrationActivateEntrySchema,
1203
1296
  IntegrationDeleteEntrySchema,
1204
1297
  IntegrationRefreshSecretEntrySchema,
1298
+ LocationCreateEntrySchema,
1299
+ LocationUpdateEntrySchema,
1300
+ AdministrativeAreaUpdateEntrySchema,
1301
+ LocationWithdrawEntrySchema,
1302
+ AdministrativeAreaWithdrawEntrySchema,
1303
+ AdministrativeAreaCreateEntrySchema,
1205
1304
  AttachmentUploadEntrySchema,
1206
1305
  UserCreateEntrySchema,
1207
1306
  UserReasonEntrySchema,
@@ -1437,6 +1536,9 @@ var CustomFieldValue = z11.unknown().brand("CustomFieldValue");
1437
1536
  // ../commons/src/events/PlainDate.ts
1438
1537
  var import_zod = require("zod");
1439
1538
  var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
1539
+ function toPlainDate(dateTime) {
1540
+ return dateTime.split("T")[0];
1541
+ }
1440
1542
  function plainDateToLocalDate(date) {
1441
1543
  const [year, month, day] = date.split("-").map(Number);
1442
1544
  return new Date(year, month - 1, day);
@@ -2299,8 +2401,8 @@ var BaseField = import_v43.default.object({
2299
2401
  conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
2300
2402
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
2301
2403
  ),
2302
- secured: import_v43.default.boolean().default(false).optional().describe(
2303
- "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
2404
+ secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
2405
+ "Indicates whether the field is secured, either always (boolean) or conditionally, evaluated against the event (a JSONSchema conditional, e.g. flag('sealed')). Secured fields are not indexed for search and are only visible when explicitly assigned."
2304
2406
  ),
2305
2407
  placeholder: TranslationConfig.optional(),
2306
2408
  validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
@@ -2698,7 +2800,13 @@ var AdministrativeAreaField = BaseField.extend({
2698
2800
  configuration: import_v43.default.object({
2699
2801
  partOf: FieldReference.optional().describe("Parent location"),
2700
2802
  type: AdministrativeAreas,
2701
- allowedLocations: AllowedLocations
2803
+ allowedLocations: AllowedLocations,
2804
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
2805
+ "Advanced search: list every historical name a location has had as a separate, selectable option."
2806
+ ),
2807
+ activeOnly: import_v43.default.boolean().optional().describe(
2808
+ "Advanced search: offer only currently-active locations; inactivated ones are excluded."
2809
+ )
2702
2810
  }).describe("Administrative area options")
2703
2811
  }).meta({
2704
2812
  description: "Administrative area input field",
@@ -2709,7 +2817,10 @@ var LocationInput = BaseField.extend({
2709
2817
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2710
2818
  configuration: import_v43.default.object({
2711
2819
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2712
- allowedLocations: AllowedLocations
2820
+ allowedLocations: AllowedLocations,
2821
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
2822
+ "Advanced search: list every historical name a location has had as a separate, selectable option."
2823
+ )
2713
2824
  }).optional()
2714
2825
  }).meta({
2715
2826
  description: "A field for selecting a location",
@@ -2735,12 +2846,18 @@ var FileUploadWithOptions = BaseField.extend({
2735
2846
  var Facility = BaseField.extend({
2736
2847
  type: import_v43.default.literal(FieldType.FACILITY),
2737
2848
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2738
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2849
+ configuration: import_v43.default.object({
2850
+ allowedLocations: AllowedLocations,
2851
+ listHistoricalNames: import_v43.default.boolean().optional()
2852
+ }).optional()
2739
2853
  }).describe("Input field for a facility");
2740
2854
  var Office = BaseField.extend({
2741
2855
  type: import_v43.default.literal(FieldType.OFFICE),
2742
2856
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2743
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2857
+ configuration: import_v43.default.object({
2858
+ allowedLocations: AllowedLocations,
2859
+ listHistoricalNames: import_v43.default.boolean().optional()
2860
+ }).optional()
2744
2861
  }).describe("Input field for an office");
2745
2862
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
2746
2863
  administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
@@ -2773,7 +2890,13 @@ var Address = BaseField.extend({
2773
2890
  parent: FieldReference.optional()
2774
2891
  })
2775
2892
  ).optional(),
2776
- allowedLocations: AllowedLocations
2893
+ allowedLocations: AllowedLocations,
2894
+ 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."
2896
+ ),
2897
+ 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."
2899
+ )
2777
2900
  }).optional(),
2778
2901
  defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2779
2902
  }).meta({
@@ -3545,45 +3668,181 @@ var LanguageConfig = z26.object({
3545
3668
  });
3546
3669
 
3547
3670
  // ../commons/src/events/EventConfig.ts
3548
- var z33 = __toESM(require("zod/v4"));
3671
+ var z34 = __toESM(require("zod/v4"));
3549
3672
 
3550
3673
  // ../commons/src/events/SummaryConfig.ts
3674
+ var z28 = __toESM(require("zod/v4"));
3675
+
3676
+ // ../commons/src/icons.ts
3551
3677
  var z27 = __toESM(require("zod/v4"));
3552
- var BaseField2 = z27.object({
3678
+ var AvailableIcons = z27.enum([
3679
+ "Archived",
3680
+ "Assigned",
3681
+ "Briefcase",
3682
+ "Certified",
3683
+ "Close",
3684
+ "Collapse",
3685
+ "Draft",
3686
+ "DuplicateYellow",
3687
+ "Expand",
3688
+ "ExternalValidate",
3689
+ "FilledCheck",
3690
+ "InReview",
3691
+ "Offline",
3692
+ "Registered",
3693
+ "RequiresUpdates",
3694
+ "Sent",
3695
+ "Validated",
3696
+ "WaitingApproval",
3697
+ "ChartActivity",
3698
+ "Activity",
3699
+ "Archive",
3700
+ "ArchiveTray",
3701
+ "ArrowLeft",
3702
+ "ArrowRight",
3703
+ "Buildings",
3704
+ "Circle",
3705
+ "CaretDown",
3706
+ "CaretLeft",
3707
+ "CaretRight",
3708
+ "ChartBar",
3709
+ "ChartLine",
3710
+ "ChatCircle",
3711
+ "CheckSquare",
3712
+ "Compass",
3713
+ "Check",
3714
+ "Copy",
3715
+ "Database",
3716
+ "DotsThreeVertical",
3717
+ "ArrowCounterClockwise",
3718
+ "MagnifyingGlassMinus",
3719
+ "MagnifyingGlassPlus",
3720
+ "Export",
3721
+ "Eye",
3722
+ "EyeSlash",
3723
+ "Envelope",
3724
+ "File",
3725
+ "FileLock",
3726
+ "FileSearch",
3727
+ "FileMinus",
3728
+ "FilePlus",
3729
+ "FileText",
3730
+ "FileX",
3731
+ "Handshake",
3732
+ "Gear",
3733
+ "GitBranch",
3734
+ "IdentificationCard",
3735
+ "List",
3736
+ "ListBullets",
3737
+ "Lock",
3738
+ "MagnifyingGlass",
3739
+ "MapPin",
3740
+ "Medal",
3741
+ "NotePencil",
3742
+ "Paperclip",
3743
+ "PaperPlaneTilt",
3744
+ "Pen",
3745
+ "PenNib",
3746
+ "Pencil",
3747
+ "PencilSimpleLine",
3748
+ "Phone",
3749
+ "Plus",
3750
+ "Printer",
3751
+ "SignOut",
3752
+ "Stamp",
3753
+ "Star",
3754
+ "Target",
3755
+ "TextT",
3756
+ "Trash",
3757
+ "UploadSimple",
3758
+ "User",
3759
+ "UserPlus",
3760
+ "Users",
3761
+ "WarningCircle",
3762
+ "X",
3763
+ "ChatText",
3764
+ "CircleWavyCheck",
3765
+ "CircleWavyQuestion",
3766
+ "ArchiveBox",
3767
+ "ArrowCircleDown",
3768
+ "FileArrowUp",
3769
+ "FileDotted",
3770
+ "Files",
3771
+ "PencilLine",
3772
+ "PencilCircle",
3773
+ "UserCircle",
3774
+ "Clock",
3775
+ "QrCode",
3776
+ "Webcam",
3777
+ "Sun",
3778
+ "DeviceTabletCamera",
3779
+ "Globe",
3780
+ "Fingerprint",
3781
+ "PushPin",
3782
+ "Timer"
3783
+ ]);
3784
+
3785
+ // ../commons/src/events/SummaryConfig.ts
3786
+ var InfoBox = z28.object({
3787
+ type: z28.enum(["info", "positive", "warning", "negative"]).describe(
3788
+ "Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
3789
+ ),
3790
+ background: z28.enum(["tinted", "white"]).default("tinted").optional().describe(
3791
+ "tinted reads as a recessed empty state; white reads as a standalone card."
3792
+ ),
3793
+ icon: AvailableIcons.optional().describe(
3794
+ "Icon displayed inside the icon block. Defaults to FileSearch."
3795
+ ),
3796
+ heading: TranslationConfig.describe(
3797
+ "Primary message. Short, sentence-case."
3798
+ ),
3799
+ description: TranslationConfig.optional().describe(
3800
+ "Secondary copy displayed below the heading, typically a suggested next step."
3801
+ ),
3802
+ conditionals: z28.array(ShowConditional).default([]).optional().describe(
3803
+ "Conditions under which the info box is shown. When omitted, it is always shown."
3804
+ )
3805
+ }).describe(
3806
+ "A compact icon-block + heading + description block displayed above the summary fields in the event overview."
3807
+ );
3808
+ var BaseField2 = z28.object({
3553
3809
  emptyValueMessage: TranslationConfig.optional().describe(
3554
3810
  "Default message displayed when the field value is empty."
3555
3811
  ),
3556
- conditionals: z27.array(ShowConditional).default([]).optional()
3812
+ conditionals: z28.array(ShowConditional).default([]).optional()
3557
3813
  });
3558
3814
  var ReferenceField = BaseField2.extend({
3559
- fieldId: z27.string(),
3815
+ fieldId: z28.string(),
3560
3816
  label: TranslationConfig.optional().describe(
3561
3817
  "Overrides the default label from the referenced field when provided."
3562
3818
  )
3563
3819
  }).describe("Field referencing existing event data by field ID.");
3564
3820
  var Field = BaseField2.extend({
3565
- id: z27.string().describe("Identifier of the summary field."),
3821
+ id: z28.string().describe("Identifier of the summary field."),
3566
3822
  value: TranslationConfig.describe(
3567
3823
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
3568
3824
  ),
3569
3825
  label: TranslationConfig
3570
3826
  }).describe("Custom field defined for the summary view.");
3571
- var SummaryConfig = z27.object({
3572
- fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3827
+ var SummaryConfig = z28.object({
3828
+ banners: z28.array(InfoBox).default([]).optional().describe(
3829
+ "Info boxes displayed above the summary fields in the event overview."
3830
+ ),
3831
+ fields: z28.array(z28.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3573
3832
  }).meta({
3574
3833
  id: "SummaryConfig",
3575
3834
  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."
3576
3835
  });
3577
3836
 
3578
3837
  // ../commons/src/events/AdvancedSearchConfig.ts
3579
- var z28 = __toESM(require("zod/v4"));
3580
- var MatchType = z28.enum(["fuzzy", "exact", "range", "within"]);
3581
- var BaseField3 = z28.object({
3582
- config: z28.object({
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({
3583
3842
  type: MatchType.describe(
3584
3843
  "Determines the search type of field. How to match value."
3585
3844
  ),
3586
- searchFields: z28.array(z28.string()).optional().describe(
3845
+ searchFields: z29.array(z29.string()).optional().describe(
3587
3846
  `
3588
3847
  Defines multiple form fields that should be searched when this field has a value.
3589
3848
  All specified fields will be combined using OR logic.
@@ -3593,7 +3852,7 @@ var BaseField3 = z28.object({
3593
3852
  `
3594
3853
  )
3595
3854
  }),
3596
- type: z28.nativeEnum(FieldType).optional().describe(
3855
+ type: z29.nativeEnum(FieldType).optional().describe(
3597
3856
  `
3598
3857
  Explicitly specify the field type for searchFields.
3599
3858
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -3607,7 +3866,7 @@ var BaseField3 = z28.object({
3607
3866
  This is required when searchFields is defined.
3608
3867
  `
3609
3868
  ),
3610
- options: z28.array(SelectOption).optional(),
3869
+ options: z29.array(SelectOption).optional(),
3611
3870
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
3612
3871
  `
3613
3872
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -3628,7 +3887,7 @@ var BaseField3 = z28.object({
3628
3887
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
3629
3888
  `
3630
3889
  ),
3631
- conditionals: z28.array(FieldConditional).optional().describe(
3890
+ conditionals: z29.array(FieldConditional).optional().describe(
3632
3891
  `
3633
3892
  In advanced search, we sometimes need to override the default field visibility conditionals.
3634
3893
 
@@ -3642,23 +3901,23 @@ var BaseField3 = z28.object({
3642
3901
  are always rendered in the advanced search form.
3643
3902
  `
3644
3903
  ),
3645
- validations: z28.array(ValidationConfig).optional().describe(
3904
+ validations: z29.array(ValidationConfig).optional().describe(
3646
3905
  `Option for overriding the field validations specifically for advanced search form.`
3647
3906
  ),
3648
3907
  allowedLocations: JurisdictionReference.optional().describe(
3649
3908
  `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.`
3650
3909
  )
3651
3910
  });
3652
- var SearchQueryParams = z28.object({
3653
- eventType: z28.string().optional().describe(
3911
+ var SearchQueryParams = z29.object({
3912
+ eventType: z29.string().optional().describe(
3654
3913
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
3655
3914
  )
3656
3915
  }).catchall(FieldValue);
3657
3916
  var FieldConfigSchema = BaseField3.extend({
3658
- fieldId: z28.string(),
3659
- fieldType: z28.literal("field")
3917
+ fieldId: z29.string(),
3918
+ fieldType: z29.literal("field")
3660
3919
  });
3661
- var EventFieldIdInput = z28.enum([
3920
+ var EventFieldIdInput = z29.enum([
3662
3921
  "trackingId",
3663
3922
  "status",
3664
3923
  "legalStatuses.REGISTERED.acceptedAt",
@@ -3667,7 +3926,7 @@ var EventFieldIdInput = z28.enum([
3667
3926
  "updatedAt"
3668
3927
  ]);
3669
3928
  var METADATA_FIELD_PREFIX = "event.";
3670
- var EventFieldId = z28.enum([
3929
+ var EventFieldId = z29.enum([
3671
3930
  `${METADATA_FIELD_PREFIX}trackingId`,
3672
3931
  `${METADATA_FIELD_PREFIX}status`,
3673
3932
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -3677,29 +3936,29 @@ var EventFieldId = z28.enum([
3677
3936
  ]);
3678
3937
  var EventFieldConfigSchema = BaseField3.extend({
3679
3938
  fieldId: EventFieldId,
3680
- fieldType: z28.literal("event")
3939
+ fieldType: z29.literal("event")
3681
3940
  });
3682
- var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3941
+ var AdvancedSearchField = z29.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3683
3942
  if (data.config.searchFields && data.config.searchFields.length > 0) {
3684
3943
  if (!data.label) {
3685
3944
  ctx.addIssue({
3686
- code: z28.ZodIssueCode.custom,
3945
+ code: z29.ZodIssueCode.custom,
3687
3946
  message: "label is required when config.searchFields is defined.",
3688
3947
  path: ["label"]
3689
3948
  });
3690
3949
  }
3691
3950
  if (!data.type) {
3692
3951
  ctx.addIssue({
3693
- code: z28.ZodIssueCode.custom,
3952
+ code: z29.ZodIssueCode.custom,
3694
3953
  message: "type is required when config.searchFields is defined.",
3695
3954
  path: ["type"]
3696
3955
  });
3697
3956
  }
3698
3957
  }
3699
3958
  });
3700
- var AdvancedSearchConfig = z28.object({
3959
+ var AdvancedSearchConfig = z29.object({
3701
3960
  title: TranslationConfig.describe("Advanced search tab title"),
3702
- fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3961
+ fields: z29.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3703
3962
  }).meta({
3704
3963
  id: "AdvancedSearchConfig",
3705
3964
  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()`)."
@@ -3711,19 +3970,19 @@ var import_lodash4 = require("lodash");
3711
3970
  // ../commons/src/conditionals/validate.ts
3712
3971
  var import__ = __toESM(require("ajv/dist/2019"));
3713
3972
  var import_ajv_formats = __toESM(require("ajv-formats"));
3714
- var z32 = __toESM(require("zod/v4"));
3973
+ var z33 = __toESM(require("zod/v4"));
3715
3974
  var import_date_fns2 = require("date-fns");
3716
3975
 
3717
3976
  // ../commons/src/events/FieldTypeMapping.ts
3718
- var z30 = __toESM(require("zod/v4"));
3977
+ var z31 = __toESM(require("zod/v4"));
3719
3978
 
3720
3979
  // ../commons/src/events/DynamicFieldValue.ts
3721
- var z29 = __toESM(require("zod/v4"));
3980
+ var z30 = __toESM(require("zod/v4"));
3722
3981
  function getDynamicNameValue(field3) {
3723
3982
  const nameConfiguration = field3.configuration?.name;
3724
3983
  const firstnameRequired = nameConfiguration?.firstname?.required ?? field3.required;
3725
3984
  const surnameRequired = nameConfiguration?.surname?.required ?? field3.required;
3726
- return z29.object({
3985
+ return z30.object({
3727
3986
  firstname: firstnameRequired ? NonEmptyTextValue : TextValue,
3728
3987
  surname: surnameRequired ? NonEmptyTextValue : TextValue,
3729
3988
  middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
@@ -3754,7 +4013,7 @@ function mapFieldTypeToZod(field3, actionType) {
3754
4013
  let schema;
3755
4014
  switch (field3.type) {
3756
4015
  case FieldType.FIELD_GROUP: {
3757
- schema = z30.object(
4016
+ schema = z31.object(
3758
4017
  field3.fields.reduce((acc, subfield) => {
3759
4018
  acc[subfield.id] = mapFieldTypeToZod(subfield, actionType);
3760
4019
  return acc;
@@ -4079,7 +4338,7 @@ var isNonInteractiveFieldType = (field3) => {
4079
4338
  var import_lodash3 = require("lodash");
4080
4339
 
4081
4340
  // ../commons/src/utils.ts
4082
- var z31 = __toESM(require("zod/v4"));
4341
+ var z32 = __toESM(require("zod/v4"));
4083
4342
  var _ = __toESM(require("lodash"));
4084
4343
  function getOrThrow(x, message) {
4085
4344
  if (x === void 0 || x === null) {
@@ -4090,11 +4349,11 @@ function getOrThrow(x, message) {
4090
4349
  function joinValues(values, separator = " ") {
4091
4350
  return values.filter((value) => !!value).join(separator).trim();
4092
4351
  }
4093
- var FullNameV1 = z31.array(
4094
- z31.object({
4095
- use: z31.string(),
4096
- family: z31.string(),
4097
- given: z31.array(z31.string())
4352
+ var FullNameV1 = z32.array(
4353
+ z32.object({
4354
+ use: z32.string(),
4355
+ family: z32.string(),
4356
+ given: z32.array(z32.string())
4098
4357
  })
4099
4358
  );
4100
4359
  function omitKeyDeep(obj, keyToRemove) {
@@ -5318,9 +5577,9 @@ var ajv = new import__.default({
5318
5577
  strict: false
5319
5578
  // Allow minContains and other newer features
5320
5579
  });
5321
- var DataContext = z32.object({
5322
- rootData: z32.object({
5323
- $leafAdminStructureLocationIds: z32.array(z32.object({ id: UUID }))
5580
+ var DataContext = z33.object({
5581
+ rootData: z33.object({
5582
+ $leafAdminStructureLocationIds: z33.array(z33.object({ id: UUID }))
5324
5583
  })
5325
5584
  });
5326
5585
  function resolveDataPath(rootData, dataPath, instancePath) {
@@ -5357,8 +5616,22 @@ function compileClientFunction(code) {
5357
5616
  return fn;
5358
5617
  }
5359
5618
  (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
+ }
5360
5633
  function buildClientFunctionContext(input) {
5361
- const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getCurrentEventState(
5634
+ const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getInMemoryEventState(
5362
5635
  input.validatorContext?.event,
5363
5636
  input.validatorContext?.eventConfig
5364
5637
  )?.flags : [];
@@ -5536,6 +5809,20 @@ function areConditionsMet(conditions, values, context, event2) {
5536
5809
  (condition) => validate(condition.conditional, clientFunctionContext)
5537
5810
  );
5538
5811
  }
5812
+ function isFieldSecured(field3, event2, context = {}) {
5813
+ if (typeof field3.secured !== "object" || field3.secured === null) {
5814
+ return Boolean(field3.secured);
5815
+ }
5816
+ const clientFunctionContext = {
5817
+ ...buildClientFunctionContext({
5818
+ form: mergeWithBaseFormState(event2.declaration, context),
5819
+ validatorContext: context
5820
+ }),
5821
+ $flags: event2.flags,
5822
+ $status: event2.status
5823
+ };
5824
+ return validate(field3.secured, clientFunctionContext);
5825
+ }
5539
5826
  function isFieldConditionMet(field3, form, conditionalType, context) {
5540
5827
  const hasRule = (field3.conditionals ?? []).some(
5541
5828
  (conditional) => conditional.type === conditionalType
@@ -6405,11 +6692,11 @@ function validateActionOrder(event2, ctx) {
6405
6692
  }
6406
6693
 
6407
6694
  // ../commons/src/events/EventConfig.ts
6408
- var EventFieldReference = z33.object({ $$event: EventMetadataDateFieldIdInput }).describe(
6695
+ var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
6409
6696
  "Reference to a field defined in the event metadata, using the field id."
6410
6697
  );
6411
- var _EventConfigBase = z33.object({
6412
- id: z33.string().describe(
6698
+ var _EventConfigBase = z34.object({
6699
+ id: z34.string().describe(
6413
6700
  'Machine-readable identifier of the event (e.g. "birth", "death").'
6414
6701
  ),
6415
6702
  dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
@@ -6428,23 +6715,26 @@ var _EventConfigBase = z33.object({
6428
6715
  "Summary information displayed in the event overview."
6429
6716
  ),
6430
6717
  label: TranslationConfig.describe("Human-readable label for the event type."),
6431
- actions: z33.array(ActionConfig).describe(
6718
+ actions: z34.array(ActionConfig).describe(
6432
6719
  "Configuration of core and custom actions associated with the event."
6433
6720
  ),
6434
- actionOrder: z33.array(z33.string()).optional().describe(
6721
+ actionOrder: z34.array(z34.string()).optional().describe(
6435
6722
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
6436
6723
  ),
6437
6724
  declaration: DeclarationFormConfig.describe(
6438
6725
  "Configuration of the form used to gather event data."
6439
6726
  ),
6440
- advancedSearch: z33.array(AdvancedSearchConfig).optional().default([]).describe(
6727
+ advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
6441
6728
  "Configuration of fields available in the advanced search feature."
6442
6729
  ),
6443
- flags: z33.array(FlagConfig).optional().default([]).describe(
6730
+ flags: z34.array(FlagConfig).optional().default([]).describe(
6444
6731
  "Configuration of custom flags associated with the actions of this event type."
6445
6732
  ),
6446
- analytics: z33.boolean().optional().default(true).describe(
6733
+ analytics: z34.boolean().optional().default(true).describe(
6447
6734
  "Indicates whether the records of this event type are included in analytics"
6735
+ ),
6736
+ icon: z34.partialRecord(AvailableIcons, Conditional).optional().describe(
6737
+ '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.'
6448
6738
  )
6449
6739
  });
6450
6740
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
@@ -6662,21 +6952,31 @@ var event = Object.assign(eventFn, {
6662
6952
  return {
6663
6953
  $event: field3
6664
6954
  };
6665
- }
6955
+ },
6956
+ /**
6957
+ * Checks if the event currently has the given status.
6958
+ * @param eventStatus - The status to check for.
6959
+ */
6960
+ hasStatus: (eventStatus) => status(eventStatus),
6961
+ /**
6962
+ * Checks if the event currently carries the given flag.
6963
+ * @param flagValue - The flag to check for.
6964
+ */
6965
+ hasFlag: (flagValue) => flag(flagValue)
6666
6966
  });
6667
6967
 
6668
6968
  // ../commons/src/events/WorkqueueColumnConfig.ts
6669
- var z34 = __toESM(require("zod/v4"));
6969
+ var z35 = __toESM(require("zod/v4"));
6670
6970
  var WorkqueueColumnKeysArray = [
6671
6971
  ...EventMetadataKeysArray,
6672
6972
  "title",
6673
6973
  "outbox"
6674
6974
  ];
6675
- var WorkqueueColumnKeys = z34.enum(WorkqueueColumnKeysArray);
6676
- var WorkqueueColumnValue = z34.object({
6975
+ var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
6976
+ var WorkqueueColumnValue = z35.object({
6677
6977
  $event: WorkqueueColumnKeys
6678
6978
  });
6679
- var WorkqueueColumn = z34.object({
6979
+ var WorkqueueColumn = z35.object({
6680
6980
  label: TranslationConfig,
6681
6981
  value: WorkqueueColumnValue
6682
6982
  }).meta({
@@ -6690,164 +6990,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
6690
6990
  }
6691
6991
 
6692
6992
  // ../commons/src/events/CountryConfigQueryInput.ts
6693
- var z35 = __toESM(require("zod/v4"));
6694
- var SerializableExact = z35.object({
6695
- type: z35.literal("exact"),
6696
- term: z35.union([z35.string(), SerializedUserField])
6697
- });
6698
- var SerializableWithin = z35.object({
6699
- type: z35.literal("within"),
6700
- location: z35.union([z35.string(), SerializedUserField])
6701
- });
6702
- var SerializedQueryExpression = z35.object({
6703
- eventType: z35.string(),
6704
- status: z35.optional(z35.union([AnyOfStatus, ExactStatus])),
6705
- createdAt: z35.optional(DateCondition),
6706
- updatedAt: z35.optional(DateCondition),
6707
- "legalStatuses.DECLARED.createdAtLocation": z35.optional(SerializableWithin),
6708
- "legalStatuses.DECLARED.createdByRole": z35.optional(AnyOf),
6709
- "legalStatuses.REGISTERED.createdAt": z35.optional(DateCondition),
6710
- "legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
6711
- "legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
6712
- "legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
6713
- createdAtLocation: z35.optional(
6714
- z35.union([SerializableWithin, SerializableExact])
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])
6715
7015
  ),
6716
- updatedAtLocation: z35.optional(
6717
- z35.union([SerializableWithin, SerializableExact])
7016
+ updatedAtLocation: z36.optional(
7017
+ z36.union([SerializableWithin, SerializableExact])
6718
7018
  ),
6719
- updatedByUserRole: z35.optional(SerializableExact),
6720
- assignedTo: z35.optional(SerializableExact),
6721
- createdBy: z35.optional(SerializableExact),
7019
+ updatedByUserRole: z36.optional(SerializableExact),
7020
+ assignedTo: z36.optional(SerializableExact),
7021
+ createdBy: z36.optional(SerializableExact),
6722
7022
  createdByUserType: ExactUserType,
6723
- updatedBy: z35.optional(SerializableExact),
6724
- trackingId: z35.optional(Exact),
6725
- flags: z35.optional(ContainsFlags),
7023
+ updatedBy: z36.optional(SerializableExact),
7024
+ trackingId: z36.optional(Exact),
7025
+ flags: z36.optional(ContainsFlags),
6726
7026
  data: QueryInput
6727
7027
  }).partial();
6728
- var Or2 = z35.object({
6729
- type: z35.literal("or"),
6730
- clauses: z35.array(SerializedQueryExpression)
7028
+ var Or2 = z36.object({
7029
+ type: z36.literal("or"),
7030
+ clauses: z36.array(SerializedQueryExpression)
6731
7031
  });
6732
- var And2 = z35.object({
6733
- type: z35.literal("and"),
6734
- clauses: z35.array(SerializedQueryExpression)
7032
+ var And2 = z36.object({
7033
+ type: z36.literal("and"),
7034
+ clauses: z36.array(SerializedQueryExpression)
6735
7035
  });
6736
- var CountryConfigQueryType = z35.discriminatedUnion("type", [And2, Or2]);
6737
- var CountryConfigQueryInputType = z35.union([
7036
+ var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
7037
+ var CountryConfigQueryInputType = z36.union([
6738
7038
  SerializedQueryExpression,
6739
7039
  And2,
6740
7040
  Or2
6741
7041
  ]);
6742
7042
 
6743
- // ../commons/src/icons.ts
6744
- var z36 = __toESM(require("zod/v4"));
6745
- var AvailableIcons = z36.enum([
6746
- "Archived",
6747
- "Assigned",
6748
- "Briefcase",
6749
- "Certified",
6750
- "Close",
6751
- "Collapse",
6752
- "Draft",
6753
- "DuplicateYellow",
6754
- "Expand",
6755
- "ExternalValidate",
6756
- "FilledCheck",
6757
- "InReview",
6758
- "Offline",
6759
- "Registered",
6760
- "RequiresUpdates",
6761
- "Sent",
6762
- "Validated",
6763
- "WaitingApproval",
6764
- "ChartActivity",
6765
- "Activity",
6766
- "Archive",
6767
- "ArchiveTray",
6768
- "ArrowLeft",
6769
- "ArrowRight",
6770
- "Buildings",
6771
- "Circle",
6772
- "CaretDown",
6773
- "CaretLeft",
6774
- "CaretRight",
6775
- "ChartBar",
6776
- "ChartLine",
6777
- "ChatCircle",
6778
- "CheckSquare",
6779
- "Compass",
6780
- "Check",
6781
- "Copy",
6782
- "Database",
6783
- "DotsThreeVertical",
6784
- "ArrowCounterClockwise",
6785
- "MagnifyingGlassMinus",
6786
- "MagnifyingGlassPlus",
6787
- "Export",
6788
- "Eye",
6789
- "EyeSlash",
6790
- "Envelope",
6791
- "File",
6792
- "FileSearch",
6793
- "FileMinus",
6794
- "FilePlus",
6795
- "FileText",
6796
- "FileX",
6797
- "Handshake",
6798
- "Gear",
6799
- "GitBranch",
6800
- "IdentificationCard",
6801
- "List",
6802
- "ListBullets",
6803
- "Lock",
6804
- "MagnifyingGlass",
6805
- "MapPin",
6806
- "Medal",
6807
- "NotePencil",
6808
- "Paperclip",
6809
- "PaperPlaneTilt",
6810
- "Pen",
6811
- "PenNib",
6812
- "Pencil",
6813
- "PencilSimpleLine",
6814
- "Phone",
6815
- "Plus",
6816
- "Printer",
6817
- "SignOut",
6818
- "Stamp",
6819
- "Star",
6820
- "Target",
6821
- "TextT",
6822
- "Trash",
6823
- "UploadSimple",
6824
- "User",
6825
- "UserPlus",
6826
- "Users",
6827
- "WarningCircle",
6828
- "X",
6829
- "ChatText",
6830
- "CircleWavyCheck",
6831
- "CircleWavyQuestion",
6832
- "ArchiveBox",
6833
- "ArrowCircleDown",
6834
- "FileArrowUp",
6835
- "FileDotted",
6836
- "Files",
6837
- "PencilLine",
6838
- "PencilCircle",
6839
- "UserCircle",
6840
- "Clock",
6841
- "QrCode",
6842
- "Webcam",
6843
- "Sun",
6844
- "DeviceTabletCamera",
6845
- "Globe",
6846
- "Fingerprint",
6847
- "PushPin",
6848
- "Timer"
6849
- ]);
6850
-
6851
7043
  // ../commons/src/events/WorkqueueConfig.ts
6852
7044
  var mandatoryColumns = defineWorkqueuesColumns([
6853
7045
  {
@@ -10520,6 +10712,31 @@ var Location = z43.object({
10520
10712
  status: LocationStatus,
10521
10713
  versions: z43.array(LocationVersion)
10522
10714
  });
10715
+ var ClientAdministrativeArea = AdministrativeArea.omit({
10716
+ name: true,
10717
+ status: true,
10718
+ externalId: true
10719
+ });
10720
+ var ClientLocation = Location.omit({
10721
+ name: true,
10722
+ status: true,
10723
+ externalId: true
10724
+ });
10725
+ function toClientLocation(location) {
10726
+ return {
10727
+ id: location.id,
10728
+ administrativeAreaId: location.administrativeAreaId,
10729
+ locationType: location.locationType,
10730
+ versions: location.versions
10731
+ };
10732
+ }
10733
+ function toClientAdministrativeArea(area) {
10734
+ return {
10735
+ id: area.id,
10736
+ parentId: area.parentId,
10737
+ versions: area.versions
10738
+ };
10739
+ }
10523
10740
  var SetLocationPayload = z43.object({
10524
10741
  id: UUID,
10525
10742
  name: z43.string(),
@@ -10542,6 +10759,13 @@ function resolveVersion(versions, anchor) {
10542
10759
  }
10543
10760
  return resolved;
10544
10761
  }
10762
+ function hasActiveExternalIdOnOrAfter(versions, externalId, anchor) {
10763
+ const inEffectAtAnchor = resolveVersion(versions, anchor);
10764
+ const laterVersions = versions.filter((v) => v.effectiveFrom > anchor);
10765
+ return [inEffectAtAnchor, ...laterVersions].some(
10766
+ (v) => v.externalId === externalId && v.status === "active"
10767
+ );
10768
+ }
10545
10769
  function matchesJurisdictionFilter(locationIds, filter, user2) {
10546
10770
  if (!locationIds) {
10547
10771
  return false;
@@ -10733,6 +10957,16 @@ function getLocationHierarchy(selectedId, context) {
10733
10957
  );
10734
10958
  return hierarchy.reverse().map((area) => area.id);
10735
10959
  }
10960
+ function resolvePath(locationId, anchor, context) {
10961
+ return getLocationHierarchy(locationId, context).flatMap((id) => {
10962
+ const node = context.locations.get(id) ?? context.administrativeAreas.get(id);
10963
+ if (!node) {
10964
+ return [];
10965
+ }
10966
+ const { name, status: status2 } = resolveVersion(node.versions, anchor);
10967
+ return [{ id, name, status: status2 }];
10968
+ });
10969
+ }
10736
10970
 
10737
10971
  // ../commons/src/events/scopes.ts
10738
10972
  var ACTION_SCOPE_MAP = {
@@ -11368,3 +11602,60 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
11368
11602
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
11369
11603
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
11370
11604
  );
11605
+ var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
11606
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
11607
+ );
11608
+ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
11609
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
11610
+ a.id,
11611
+ toClientAdministrativeArea(a)
11612
+ ])
11613
+ );
11614
+
11615
+ // ../commons/src/events/locationPayloads.ts
11616
+ var z44 = __toESM(require("zod/v4"));
11617
+ var CreateLocationPayload = z44.object({
11618
+ id: UUID.optional(),
11619
+ versionId: UUID.optional(),
11620
+ name: z44.string(),
11621
+ externalId: z44.string().nullish(),
11622
+ administrativeAreaId: UUID.nullable(),
11623
+ locationType: z44.string().nullable(),
11624
+ effectiveFrom: z44.iso.date().optional(),
11625
+ status: LocationStatus.default("active")
11626
+ });
11627
+ var UpdateLocationPayload = z44.strictObject({
11628
+ id: UUID,
11629
+ versionId: UUID.optional(),
11630
+ name: z44.string(),
11631
+ externalId: z44.string().nullish(),
11632
+ status: LocationStatus,
11633
+ effectiveFrom: z44.iso.date().optional(),
11634
+ lastVersionId: UUID
11635
+ });
11636
+ var WithdrawLocationVersionPayload = z44.object({
11637
+ id: UUID,
11638
+ versionId: UUID
11639
+ });
11640
+ var CreateAdministrativeAreaPayload = z44.object({
11641
+ id: UUID.optional(),
11642
+ versionId: UUID.optional(),
11643
+ name: z44.string(),
11644
+ externalId: z44.string().nullish(),
11645
+ parentId: UUID.nullable(),
11646
+ effectiveFrom: z44.iso.date().optional(),
11647
+ status: LocationStatus.default("active")
11648
+ });
11649
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
11650
+ id: UUID,
11651
+ versionId: UUID.optional(),
11652
+ name: z44.string(),
11653
+ externalId: z44.string().nullish(),
11654
+ status: LocationStatus,
11655
+ effectiveFrom: z44.iso.date().optional(),
11656
+ lastVersionId: UUID
11657
+ });
11658
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
11659
+ id: UUID,
11660
+ versionId: UUID
11661
+ });