@opencrvs/toolkit 2.1.0-rc.b061691 → 2.1.0-rc.b263ac1

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 (80) hide show
  1. package/README.md +1 -0
  2. package/dist/application-config/index.js +34 -11
  3. package/dist/cli.js +174 -58
  4. package/dist/commons/api/router.d.ts +3528 -3251
  5. package/dist/commons/application-config/index.d.ts +6 -6
  6. package/dist/commons/conditionals/conditionals.d.ts +259 -2102
  7. package/dist/commons/conditionals/validate.d.ts +9 -3
  8. package/dist/commons/events/ActionConfig.d.ts +105 -126
  9. package/dist/commons/events/ActionDocument.d.ts +110 -110
  10. package/dist/commons/events/ActionStatus.d.ts +3 -3
  11. package/dist/commons/events/ActionType.d.ts +62 -62
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +525 -513
  13. package/dist/commons/events/AuditLog.d.ts +189 -42
  14. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  15. package/dist/commons/events/Conditional.d.ts +3 -3
  16. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -608
  17. package/dist/commons/events/Draft.d.ts +37 -37
  18. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  19. package/dist/commons/events/EventConfig.d.ts +8 -5
  20. package/dist/commons/events/EventDocument.d.ts +46 -46
  21. package/dist/commons/events/EventIndex.d.ts +48 -52
  22. package/dist/commons/events/EventMetadata.d.ts +40 -41
  23. package/dist/commons/events/FieldConfig.d.ts +413 -396
  24. package/dist/commons/events/FieldType.d.ts +51 -51
  25. package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
  26. package/dist/commons/events/FieldValue.d.ts +14 -14
  27. package/dist/commons/events/Flag.d.ts +30 -36
  28. package/dist/commons/events/PlainDate.d.ts +8 -0
  29. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  30. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  31. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  32. package/dist/commons/events/WorkqueueConfig.d.ts +817 -829
  33. package/dist/commons/events/deduplication.d.ts +1 -1
  34. package/dist/commons/events/event.d.ts +14 -2
  35. package/dist/commons/events/field.d.ts +78 -895
  36. package/dist/commons/events/index.d.ts +1 -0
  37. package/dist/commons/events/locationPayloads.d.ts +95 -0
  38. package/dist/commons/events/locations.d.ts +192 -12
  39. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  40. package/dist/commons/events/scopes.d.ts +4 -4
  41. package/dist/commons/events/state/index.d.ts +17 -17
  42. package/dist/commons/events/state/utils.d.ts +7 -7
  43. package/dist/commons/events/test.utils.d.ts +40 -40
  44. package/dist/commons/events/utils.d.ts +114 -114
  45. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  46. package/dist/conditionals/index.js +6 -4
  47. package/dist/environment/derived-variables.d.ts +119 -119
  48. package/dist/environment/derived-variables.d.ts.map +1 -1
  49. package/dist/environment/index.d.ts +1 -0
  50. package/dist/environment/index.d.ts.map +1 -1
  51. package/dist/environment/index.js +10 -0
  52. package/dist/environment/logger.d.ts +12 -3
  53. package/dist/environment/logger.d.ts.map +1 -1
  54. package/dist/environment/paths.d.ts +7 -0
  55. package/dist/environment/paths.d.ts.map +1 -0
  56. package/dist/environment/paths.js +72 -0
  57. package/dist/environment/questions.d.ts +75 -74
  58. package/dist/environment/questions.d.ts.map +1 -1
  59. package/dist/environment/setup-environment.js +10 -15
  60. package/dist/environment/templates.d.ts.map +1 -1
  61. package/dist/environment/templates.js +2 -1
  62. package/dist/environment/update-workflows.d.ts.map +1 -1
  63. package/dist/environment/update-workflows.js +17 -5
  64. package/dist/environment/upgrade.d.ts +2 -0
  65. package/dist/environment/upgrade.d.ts.map +1 -0
  66. package/dist/environment/upgrade.js +82 -0
  67. package/dist/environment/users.js +11 -13
  68. package/dist/environment/utils.d.ts +1 -1
  69. package/dist/events/deduplication.d.ts +1 -1
  70. package/dist/events/index.js +568 -265
  71. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  72. package/dist/notification/index.js +578 -316
  73. package/dist/scopes/index.d.ts +350 -332
  74. package/dist/scopes/index.js +6 -4
  75. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  76. package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
  77. package/opencrvs-toolkit-2.1.0-rc.b263ac1.tgz +0 -0
  78. package/package.json +6 -6
  79. package/tsconfig.tsbuildinfo +1 -1
  80. package/opencrvs-toolkit-2.1.0-rc.b061691.tgz +0 -0
@@ -38,7 +38,7 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z45 = __toESM(require("zod/v4"));
41
+ var z46 = __toESM(require("zod/v4"));
42
42
 
43
43
  // ../commons/src/url.ts
44
44
  function joinUrl(base, path) {
@@ -266,8 +266,7 @@ var InherentFlags = {
266
266
  *
267
267
  * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
268
268
  */
269
- EDIT_IN_PROGRESS: "edit-in-progress",
270
- SEALED: "sealed"
269
+ EDIT_IN_PROGRESS: "edit-in-progress"
271
270
  };
272
271
  var actionFlagPattern;
273
272
  function getActionFlagPattern() {
@@ -348,6 +347,7 @@ var PlainScopeType = z6.enum([
348
347
  "integration.create",
349
348
  "record.import",
350
349
  "config.update-all",
350
+ "location.edit",
351
351
  "attachment.upload",
352
352
  "profile.electronic-signature",
353
353
  "user.read-only-my-audit",
@@ -369,7 +369,8 @@ var userRole = z6.preprocess(
369
369
  ).describe("User role, e.g. admin, field agent");
370
370
  var scopeOptionsPlaceEvent = z6.object({
371
371
  event: scopeByEvent,
372
- placeOfEvent: JurisdictionFilter.optional()
372
+ placeOfEvent: JurisdictionFilter.optional(),
373
+ createdBy: UserFilter.optional()
373
374
  }).describe("Options applicable to all record scopes.");
374
375
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
375
376
  notifiedIn: JurisdictionFilter.optional(),
@@ -411,7 +412,8 @@ var AllScopeOptions = z6.object({
411
412
  var ScopeOptionKey = AllScopeOptions.keyof();
412
413
  var ResolvedScopeOptionsPlaceEvent = z6.object({
413
414
  event: scopeByEvent,
414
- placeOfEvent: UUID.nullish()
415
+ placeOfEvent: UUID.nullish(),
416
+ createdBy: z6.string().optional()
415
417
  }).describe(
416
418
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
417
419
  );
@@ -673,6 +675,82 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
673
675
  requestData: z8.object({ id: z8.string() }),
674
676
  responseSummary: z8.object({ clientId: z8.string() })
675
677
  });
678
+ var createdVersionFields = {
679
+ id: z8.string(),
680
+ versionId: z8.string(),
681
+ name: z8.string(),
682
+ externalId: z8.string().nullish(),
683
+ effectiveFrom: z8.string(),
684
+ status: z8.string()
685
+ };
686
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
687
+ operation: z8.literal("locations.create"),
688
+ requestData: z8.object({
689
+ ...createdVersionFields,
690
+ administrativeAreaId: z8.string().nullish(),
691
+ locationType: z8.string().nullish()
692
+ })
693
+ });
694
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
695
+ operation: z8.literal("administrativeAreas.create"),
696
+ requestData: z8.object({
697
+ ...createdVersionFields,
698
+ parentId: z8.string().nullish()
699
+ })
700
+ });
701
+ var ChangedStringField = z8.object({ from: z8.string(), to: z8.string() });
702
+ var ChangedNullableStringField = z8.object({
703
+ from: z8.string().nullable(),
704
+ to: z8.string().nullable()
705
+ });
706
+ var updatedVersionRequestData = z8.object({
707
+ id: z8.string(),
708
+ versionId: z8.string(),
709
+ name: z8.string(),
710
+ externalId: z8.string().nullish(),
711
+ status: z8.string(),
712
+ effectiveFrom: z8.string(),
713
+ lastVersionId: z8.string()
714
+ });
715
+ var updatedVersionResponseSummary = z8.object({
716
+ previousVersionId: z8.string(),
717
+ versionId: z8.string(),
718
+ changed: z8.object({
719
+ name: ChangedStringField.optional(),
720
+ externalId: ChangedNullableStringField.optional(),
721
+ status: ChangedStringField.optional()
722
+ })
723
+ });
724
+ var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
725
+ operation: z8.literal("locations.update"),
726
+ requestData: updatedVersionRequestData,
727
+ responseSummary: updatedVersionResponseSummary
728
+ });
729
+ var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
730
+ operation: z8.literal("administrativeAreas.update"),
731
+ requestData: updatedVersionRequestData,
732
+ responseSummary: updatedVersionResponseSummary
733
+ });
734
+ var withdrawVersionRequestData = z8.object({
735
+ id: z8.string(),
736
+ versionId: z8.string()
737
+ });
738
+ var withdrawVersionResponseSummary = z8.object({
739
+ effectiveFrom: z8.string(),
740
+ name: z8.string(),
741
+ externalId: z8.string().nullish(),
742
+ status: z8.string()
743
+ });
744
+ var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
745
+ operation: z8.literal("locations.withdrawVersion"),
746
+ requestData: withdrawVersionRequestData,
747
+ responseSummary: withdrawVersionResponseSummary
748
+ });
749
+ var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
750
+ operation: z8.literal("administrativeAreas.withdrawVersion"),
751
+ requestData: withdrawVersionRequestData,
752
+ responseSummary: withdrawVersionResponseSummary
753
+ });
676
754
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
677
755
  operation: z8.literal("attachments.upload"),
678
756
  requestData: z8.object({
@@ -748,6 +826,12 @@ var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
748
826
  IntegrationActivateEntrySchema,
749
827
  IntegrationDeleteEntrySchema,
750
828
  IntegrationRefreshSecretEntrySchema,
829
+ LocationCreateEntrySchema,
830
+ LocationUpdateEntrySchema,
831
+ AdministrativeAreaUpdateEntrySchema,
832
+ LocationWithdrawEntrySchema,
833
+ AdministrativeAreaWithdrawEntrySchema,
834
+ AdministrativeAreaCreateEntrySchema,
751
835
  AttachmentUploadEntrySchema,
752
836
  UserCreateEntrySchema,
753
837
  UserReasonEntrySchema,
@@ -1756,8 +1840,8 @@ var BaseField = import_v43.default.object({
1756
1840
  conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
1757
1841
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
1758
1842
  ),
1759
- secured: import_v43.default.boolean().default(false).optional().describe(
1760
- "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
1843
+ secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
1844
+ "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."
1761
1845
  ),
1762
1846
  placeholder: TranslationConfig.optional(),
1763
1847
  validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
@@ -2155,7 +2239,13 @@ var AdministrativeAreaField = BaseField.extend({
2155
2239
  configuration: import_v43.default.object({
2156
2240
  partOf: FieldReference.optional().describe("Parent location"),
2157
2241
  type: AdministrativeAreas,
2158
- allowedLocations: AllowedLocations
2242
+ allowedLocations: AllowedLocations,
2243
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
2244
+ "Advanced search: list every historical name a location has had as a separate, selectable option."
2245
+ ),
2246
+ activeOnly: import_v43.default.boolean().optional().describe(
2247
+ "Advanced search: offer only currently-active locations; inactivated ones are excluded."
2248
+ )
2159
2249
  }).describe("Administrative area options")
2160
2250
  }).meta({
2161
2251
  description: "Administrative area input field",
@@ -2166,7 +2256,10 @@ var LocationInput = BaseField.extend({
2166
2256
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2167
2257
  configuration: import_v43.default.object({
2168
2258
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2169
- allowedLocations: AllowedLocations
2259
+ allowedLocations: AllowedLocations,
2260
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
2261
+ "Advanced search: list every historical name a location has had as a separate, selectable option."
2262
+ )
2170
2263
  }).optional()
2171
2264
  }).meta({
2172
2265
  description: "A field for selecting a location",
@@ -2192,12 +2285,18 @@ var FileUploadWithOptions = BaseField.extend({
2192
2285
  var Facility = BaseField.extend({
2193
2286
  type: import_v43.default.literal(FieldType.FACILITY),
2194
2287
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2195
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2288
+ configuration: import_v43.default.object({
2289
+ allowedLocations: AllowedLocations,
2290
+ listHistoricalNames: import_v43.default.boolean().optional()
2291
+ }).optional()
2196
2292
  }).describe("Input field for a facility");
2197
2293
  var Office = BaseField.extend({
2198
2294
  type: import_v43.default.literal(FieldType.OFFICE),
2199
2295
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2200
- configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2296
+ configuration: import_v43.default.object({
2297
+ allowedLocations: AllowedLocations,
2298
+ listHistoricalNames: import_v43.default.boolean().optional()
2299
+ }).optional()
2201
2300
  }).describe("Input field for an office");
2202
2301
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
2203
2302
  administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
@@ -2230,7 +2329,13 @@ var Address = BaseField.extend({
2230
2329
  parent: FieldReference.optional()
2231
2330
  })
2232
2331
  ).optional(),
2233
- allowedLocations: AllowedLocations
2332
+ allowedLocations: AllowedLocations,
2333
+ listHistoricalNames: import_v43.default.boolean().optional().describe(
2334
+ "Advanced search: list every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
2335
+ ),
2336
+ activeOnly: import_v43.default.boolean().optional().describe(
2337
+ "Advanced search: offer only currently-active admin areas; inactivated ones are excluded. Propagated to the embedded admin-area selectors."
2338
+ )
2234
2339
  }).optional(),
2235
2340
  defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2236
2341
  }).meta({
@@ -3002,45 +3107,181 @@ var LanguageConfig = z26.object({
3002
3107
  });
3003
3108
 
3004
3109
  // ../commons/src/events/EventConfig.ts
3005
- var z33 = __toESM(require("zod/v4"));
3110
+ var z34 = __toESM(require("zod/v4"));
3006
3111
 
3007
3112
  // ../commons/src/events/SummaryConfig.ts
3113
+ var z28 = __toESM(require("zod/v4"));
3114
+
3115
+ // ../commons/src/icons.ts
3008
3116
  var z27 = __toESM(require("zod/v4"));
3009
- var BaseField2 = z27.object({
3117
+ var AvailableIcons = z27.enum([
3118
+ "Archived",
3119
+ "Assigned",
3120
+ "Briefcase",
3121
+ "Certified",
3122
+ "Close",
3123
+ "Collapse",
3124
+ "Draft",
3125
+ "DuplicateYellow",
3126
+ "Expand",
3127
+ "ExternalValidate",
3128
+ "FilledCheck",
3129
+ "InReview",
3130
+ "Offline",
3131
+ "Registered",
3132
+ "RequiresUpdates",
3133
+ "Sent",
3134
+ "Validated",
3135
+ "WaitingApproval",
3136
+ "ChartActivity",
3137
+ "Activity",
3138
+ "Archive",
3139
+ "ArchiveTray",
3140
+ "ArrowLeft",
3141
+ "ArrowRight",
3142
+ "Buildings",
3143
+ "Circle",
3144
+ "CaretDown",
3145
+ "CaretLeft",
3146
+ "CaretRight",
3147
+ "ChartBar",
3148
+ "ChartLine",
3149
+ "ChatCircle",
3150
+ "CheckSquare",
3151
+ "Compass",
3152
+ "Check",
3153
+ "Copy",
3154
+ "Database",
3155
+ "DotsThreeVertical",
3156
+ "ArrowCounterClockwise",
3157
+ "MagnifyingGlassMinus",
3158
+ "MagnifyingGlassPlus",
3159
+ "Export",
3160
+ "Eye",
3161
+ "EyeSlash",
3162
+ "Envelope",
3163
+ "File",
3164
+ "FileLock",
3165
+ "FileSearch",
3166
+ "FileMinus",
3167
+ "FilePlus",
3168
+ "FileText",
3169
+ "FileX",
3170
+ "Handshake",
3171
+ "Gear",
3172
+ "GitBranch",
3173
+ "IdentificationCard",
3174
+ "List",
3175
+ "ListBullets",
3176
+ "Lock",
3177
+ "MagnifyingGlass",
3178
+ "MapPin",
3179
+ "Medal",
3180
+ "NotePencil",
3181
+ "Paperclip",
3182
+ "PaperPlaneTilt",
3183
+ "Pen",
3184
+ "PenNib",
3185
+ "Pencil",
3186
+ "PencilSimpleLine",
3187
+ "Phone",
3188
+ "Plus",
3189
+ "Printer",
3190
+ "SignOut",
3191
+ "Stamp",
3192
+ "Star",
3193
+ "Target",
3194
+ "TextT",
3195
+ "Trash",
3196
+ "UploadSimple",
3197
+ "User",
3198
+ "UserPlus",
3199
+ "Users",
3200
+ "WarningCircle",
3201
+ "X",
3202
+ "ChatText",
3203
+ "CircleWavyCheck",
3204
+ "CircleWavyQuestion",
3205
+ "ArchiveBox",
3206
+ "ArrowCircleDown",
3207
+ "FileArrowUp",
3208
+ "FileDotted",
3209
+ "Files",
3210
+ "PencilLine",
3211
+ "PencilCircle",
3212
+ "UserCircle",
3213
+ "Clock",
3214
+ "QrCode",
3215
+ "Webcam",
3216
+ "Sun",
3217
+ "DeviceTabletCamera",
3218
+ "Globe",
3219
+ "Fingerprint",
3220
+ "PushPin",
3221
+ "Timer"
3222
+ ]);
3223
+
3224
+ // ../commons/src/events/SummaryConfig.ts
3225
+ var InfoBox = z28.object({
3226
+ type: z28.enum(["info", "positive", "warning", "negative"]).describe(
3227
+ "Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
3228
+ ),
3229
+ background: z28.enum(["tinted", "white"]).default("tinted").optional().describe(
3230
+ "tinted reads as a recessed empty state; white reads as a standalone card."
3231
+ ),
3232
+ icon: AvailableIcons.optional().describe(
3233
+ "Icon displayed inside the icon block. Defaults to FileSearch."
3234
+ ),
3235
+ heading: TranslationConfig.describe(
3236
+ "Primary message. Short, sentence-case."
3237
+ ),
3238
+ description: TranslationConfig.optional().describe(
3239
+ "Secondary copy displayed below the heading, typically a suggested next step."
3240
+ ),
3241
+ conditionals: z28.array(ShowConditional).default([]).optional().describe(
3242
+ "Conditions under which the info box is shown. When omitted, it is always shown."
3243
+ )
3244
+ }).describe(
3245
+ "A compact icon-block + heading + description block displayed above the summary fields in the event overview."
3246
+ );
3247
+ var BaseField2 = z28.object({
3010
3248
  emptyValueMessage: TranslationConfig.optional().describe(
3011
3249
  "Default message displayed when the field value is empty."
3012
3250
  ),
3013
- conditionals: z27.array(ShowConditional).default([]).optional()
3251
+ conditionals: z28.array(ShowConditional).default([]).optional()
3014
3252
  });
3015
3253
  var ReferenceField = BaseField2.extend({
3016
- fieldId: z27.string(),
3254
+ fieldId: z28.string(),
3017
3255
  label: TranslationConfig.optional().describe(
3018
3256
  "Overrides the default label from the referenced field when provided."
3019
3257
  )
3020
3258
  }).describe("Field referencing existing event data by field ID.");
3021
3259
  var Field = BaseField2.extend({
3022
- id: z27.string().describe("Identifier of the summary field."),
3260
+ id: z28.string().describe("Identifier of the summary field."),
3023
3261
  value: TranslationConfig.describe(
3024
3262
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
3025
3263
  ),
3026
3264
  label: TranslationConfig
3027
3265
  }).describe("Custom field defined for the summary view.");
3028
- var SummaryConfig = z27.object({
3029
- fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3266
+ var SummaryConfig = z28.object({
3267
+ banners: z28.array(InfoBox).default([]).optional().describe(
3268
+ "Info boxes displayed above the summary fields in the event overview."
3269
+ ),
3270
+ fields: z28.array(z28.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3030
3271
  }).meta({
3031
3272
  id: "SummaryConfig",
3032
3273
  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."
3033
3274
  });
3034
3275
 
3035
3276
  // ../commons/src/events/AdvancedSearchConfig.ts
3036
- var z28 = __toESM(require("zod/v4"));
3037
- var MatchType = z28.enum(["fuzzy", "exact", "range", "within"]);
3038
- var BaseField3 = z28.object({
3039
- config: z28.object({
3277
+ var z29 = __toESM(require("zod/v4"));
3278
+ var MatchType = z29.enum(["fuzzy", "exact", "range", "within"]);
3279
+ var BaseField3 = z29.object({
3280
+ config: z29.object({
3040
3281
  type: MatchType.describe(
3041
3282
  "Determines the search type of field. How to match value."
3042
3283
  ),
3043
- searchFields: z28.array(z28.string()).optional().describe(
3284
+ searchFields: z29.array(z29.string()).optional().describe(
3044
3285
  `
3045
3286
  Defines multiple form fields that should be searched when this field has a value.
3046
3287
  All specified fields will be combined using OR logic.
@@ -3050,7 +3291,7 @@ var BaseField3 = z28.object({
3050
3291
  `
3051
3292
  )
3052
3293
  }),
3053
- type: z28.nativeEnum(FieldType).optional().describe(
3294
+ type: z29.nativeEnum(FieldType).optional().describe(
3054
3295
  `
3055
3296
  Explicitly specify the field type for searchFields.
3056
3297
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -3064,7 +3305,7 @@ var BaseField3 = z28.object({
3064
3305
  This is required when searchFields is defined.
3065
3306
  `
3066
3307
  ),
3067
- options: z28.array(SelectOption).optional(),
3308
+ options: z29.array(SelectOption).optional(),
3068
3309
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
3069
3310
  `
3070
3311
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -3085,7 +3326,7 @@ var BaseField3 = z28.object({
3085
3326
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
3086
3327
  `
3087
3328
  ),
3088
- conditionals: z28.array(FieldConditional).optional().describe(
3329
+ conditionals: z29.array(FieldConditional).optional().describe(
3089
3330
  `
3090
3331
  In advanced search, we sometimes need to override the default field visibility conditionals.
3091
3332
 
@@ -3099,23 +3340,23 @@ var BaseField3 = z28.object({
3099
3340
  are always rendered in the advanced search form.
3100
3341
  `
3101
3342
  ),
3102
- validations: z28.array(ValidationConfig).optional().describe(
3343
+ validations: z29.array(ValidationConfig).optional().describe(
3103
3344
  `Option for overriding the field validations specifically for advanced search form.`
3104
3345
  ),
3105
3346
  allowedLocations: JurisdictionReference.optional().describe(
3106
3347
  `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.`
3107
3348
  )
3108
3349
  });
3109
- var SearchQueryParams = z28.object({
3110
- eventType: z28.string().optional().describe(
3350
+ var SearchQueryParams = z29.object({
3351
+ eventType: z29.string().optional().describe(
3111
3352
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
3112
3353
  )
3113
3354
  }).catchall(FieldValue);
3114
3355
  var FieldConfigSchema = BaseField3.extend({
3115
- fieldId: z28.string(),
3116
- fieldType: z28.literal("field")
3356
+ fieldId: z29.string(),
3357
+ fieldType: z29.literal("field")
3117
3358
  });
3118
- var EventFieldIdInput = z28.enum([
3359
+ var EventFieldIdInput = z29.enum([
3119
3360
  "trackingId",
3120
3361
  "status",
3121
3362
  "legalStatuses.REGISTERED.acceptedAt",
@@ -3124,7 +3365,7 @@ var EventFieldIdInput = z28.enum([
3124
3365
  "updatedAt"
3125
3366
  ]);
3126
3367
  var METADATA_FIELD_PREFIX = "event.";
3127
- var EventFieldId = z28.enum([
3368
+ var EventFieldId = z29.enum([
3128
3369
  `${METADATA_FIELD_PREFIX}trackingId`,
3129
3370
  `${METADATA_FIELD_PREFIX}status`,
3130
3371
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -3134,29 +3375,29 @@ var EventFieldId = z28.enum([
3134
3375
  ]);
3135
3376
  var EventFieldConfigSchema = BaseField3.extend({
3136
3377
  fieldId: EventFieldId,
3137
- fieldType: z28.literal("event")
3378
+ fieldType: z29.literal("event")
3138
3379
  });
3139
- var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3380
+ var AdvancedSearchField = z29.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
3140
3381
  if (data.config.searchFields && data.config.searchFields.length > 0) {
3141
3382
  if (!data.label) {
3142
3383
  ctx.addIssue({
3143
- code: z28.ZodIssueCode.custom,
3384
+ code: z29.ZodIssueCode.custom,
3144
3385
  message: "label is required when config.searchFields is defined.",
3145
3386
  path: ["label"]
3146
3387
  });
3147
3388
  }
3148
3389
  if (!data.type) {
3149
3390
  ctx.addIssue({
3150
- code: z28.ZodIssueCode.custom,
3391
+ code: z29.ZodIssueCode.custom,
3151
3392
  message: "type is required when config.searchFields is defined.",
3152
3393
  path: ["type"]
3153
3394
  });
3154
3395
  }
3155
3396
  }
3156
3397
  });
3157
- var AdvancedSearchConfig = z28.object({
3398
+ var AdvancedSearchConfig = z29.object({
3158
3399
  title: TranslationConfig.describe("Advanced search tab title"),
3159
- fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3400
+ fields: z29.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3160
3401
  }).meta({
3161
3402
  id: "AdvancedSearchConfig",
3162
3403
  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()`)."
@@ -3168,20 +3409,20 @@ var import_lodash4 = require("lodash");
3168
3409
  // ../commons/src/conditionals/validate.ts
3169
3410
  var import__ = __toESM(require("ajv/dist/2019"));
3170
3411
  var import_ajv_formats = __toESM(require("ajv-formats"));
3171
- var z32 = __toESM(require("zod/v4"));
3412
+ var z33 = __toESM(require("zod/v4"));
3172
3413
  var import_date_fns2 = require("date-fns");
3173
3414
 
3174
3415
  // ../commons/src/events/FieldTypeMapping.ts
3175
- var z30 = __toESM(require("zod/v4"));
3416
+ var z31 = __toESM(require("zod/v4"));
3176
3417
 
3177
3418
  // ../commons/src/events/DynamicFieldValue.ts
3178
- var z29 = __toESM(require("zod/v4"));
3419
+ var z30 = __toESM(require("zod/v4"));
3179
3420
 
3180
3421
  // ../commons/src/events/state/index.ts
3181
3422
  var import_lodash3 = require("lodash");
3182
3423
 
3183
3424
  // ../commons/src/utils.ts
3184
- var z31 = __toESM(require("zod/v4"));
3425
+ var z32 = __toESM(require("zod/v4"));
3185
3426
  var _ = __toESM(require("lodash"));
3186
3427
  function getOrThrow(x, message) {
3187
3428
  if (x === void 0 || x === null) {
@@ -3192,11 +3433,11 @@ function getOrThrow(x, message) {
3192
3433
  function joinValues(values, separator = " ") {
3193
3434
  return values.filter((value) => !!value).join(separator).trim();
3194
3435
  }
3195
- var FullNameV1 = z31.array(
3196
- z31.object({
3197
- use: z31.string(),
3198
- family: z31.string(),
3199
- given: z31.array(z31.string())
3436
+ var FullNameV1 = z32.array(
3437
+ z32.object({
3438
+ use: z32.string(),
3439
+ family: z32.string(),
3440
+ given: z32.array(z32.string())
3200
3441
  })
3201
3442
  );
3202
3443
  function omitKeyDeep(obj, keyToRemove) {
@@ -3444,24 +3685,24 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
3444
3685
  }
3445
3686
  function getActionStatusFlags(sortedActions) {
3446
3687
  const actionStatus = sortedActions.reduce(
3447
- (actionStatuses, { type, status }) => ({
3688
+ (actionStatuses, { type, status: status2 }) => ({
3448
3689
  ...actionStatuses,
3449
- [type]: status
3690
+ [type]: status2
3450
3691
  }),
3451
3692
  {}
3452
3693
  );
3453
- return Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
3454
- const flag = joinValues([type, status], ":").toLowerCase();
3455
- return flag;
3694
+ return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
3695
+ const flag2 = joinValues([type, status2], ":").toLowerCase();
3696
+ return flag2;
3456
3697
  });
3457
3698
  }
3458
3699
  function getInherentFlags(sortedActions, event2, eventConfiguration) {
3459
3700
  const acceptedActions = sortedActions.filter(
3460
- ({ status }) => status === ActionStatus.Accepted
3701
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
3461
3702
  );
3462
3703
  return INHERENT_FLAG_RULES.filter(
3463
3704
  (rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
3464
- ).map(({ flag }) => flag);
3705
+ ).map(({ flag: flag2 }) => flag2);
3465
3706
  }
3466
3707
  function getEventFlags(event2, config) {
3467
3708
  const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
@@ -3678,6 +3919,33 @@ function defineComparison(field3, value, keyword) {
3678
3919
  required: [field3.$$field]
3679
3920
  });
3680
3921
  }
3922
+ function flag(flagvalue) {
3923
+ return defineConditional({
3924
+ type: "object",
3925
+ properties: {
3926
+ $flags: {
3927
+ type: "array",
3928
+ contains: {
3929
+ type: "string",
3930
+ const: flagvalue
3931
+ }
3932
+ }
3933
+ },
3934
+ required: ["$flags"]
3935
+ });
3936
+ }
3937
+ function status(statusValue) {
3938
+ return defineConditional({
3939
+ type: "object",
3940
+ properties: {
3941
+ $status: {
3942
+ type: "string",
3943
+ const: statusValue
3944
+ }
3945
+ },
3946
+ required: ["$status"]
3947
+ });
3948
+ }
3681
3949
  function createFieldConditionals(fieldId) {
3682
3950
  const getDayRange = (field3, days, clause, referenceDate) => ({
3683
3951
  type: "object",
@@ -4082,7 +4350,7 @@ function createFieldConditionals(fieldId) {
4082
4350
  // ../commons/src/events/state/index.ts
4083
4351
  function getStatusFromActions(actions) {
4084
4352
  const acceptedActions = actions.filter(
4085
- ({ status }) => status === ActionStatus.Accepted
4353
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
4086
4354
  );
4087
4355
  const isCurrentlyArchived = acceptedActions.reduce(
4088
4356
  (archived, action) => {
@@ -4101,7 +4369,7 @@ function getStatusFromActions(actions) {
4101
4369
  }
4102
4370
  return acceptedActions.filter(
4103
4371
  ({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
4104
- ).reduce((status, action) => {
4372
+ ).reduce((status2, action) => {
4105
4373
  switch (action.type) {
4106
4374
  case ActionType.CREATE:
4107
4375
  return EventStatus.enum.CREATED;
@@ -4128,7 +4396,7 @@ function getStatusFromActions(actions) {
4128
4396
  case ActionType.READ:
4129
4397
  case ActionType.EDIT:
4130
4398
  default:
4131
- return status;
4399
+ return status2;
4132
4400
  }
4133
4401
  }, EventStatus.enum.CREATED);
4134
4402
  }
@@ -4224,12 +4492,12 @@ function getCurrentEventState(event2, config) {
4224
4492
  const requestActionMetadata = getActionUpdateMetadata(sortedActions);
4225
4493
  const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
4226
4494
  const declaration = aggregateActionDeclarations(event2);
4227
- const status = getStatusFromActions(sortedActions);
4495
+ const status2 = getStatusFromActions(sortedActions);
4228
4496
  const legalStatuses = getLegalStatuses(sortedActions);
4229
4497
  const base = deepDropNulls({
4230
4498
  id: event2.id,
4231
4499
  type: event2.type,
4232
- status,
4500
+ status: status2,
4233
4501
  legalStatuses,
4234
4502
  createdAt: creationAction.createdAt,
4235
4503
  createdBy: creationAction.createdBy,
@@ -4263,9 +4531,9 @@ var ajv = new import__.default({
4263
4531
  strict: false
4264
4532
  // Allow minContains and other newer features
4265
4533
  });
4266
- var DataContext = z32.object({
4267
- rootData: z32.object({
4268
- $leafAdminStructureLocationIds: z32.array(z32.object({ id: UUID }))
4534
+ var DataContext = z33.object({
4535
+ rootData: z33.object({
4536
+ $leafAdminStructureLocationIds: z33.array(z33.object({ id: UUID }))
4269
4537
  })
4270
4538
  });
4271
4539
  function resolveDataPath(rootData, dataPath, instancePath) {
@@ -4302,8 +4570,22 @@ function compileClientFunction(code) {
4302
4570
  return fn;
4303
4571
  }
4304
4572
  (0, import_ajv_formats.default)(ajv);
4573
+ var inMemoryEventStateCache = /* @__PURE__ */ new WeakMap();
4574
+ function getInMemoryEventState(event2, config) {
4575
+ let stateByConfig = inMemoryEventStateCache.get(event2);
4576
+ if (!stateByConfig) {
4577
+ stateByConfig = /* @__PURE__ */ new WeakMap();
4578
+ inMemoryEventStateCache.set(event2, stateByConfig);
4579
+ }
4580
+ let state = stateByConfig.get(config);
4581
+ if (!state) {
4582
+ state = getCurrentEventState(event2, config);
4583
+ stateByConfig.set(config, state);
4584
+ }
4585
+ return state;
4586
+ }
4305
4587
  function buildClientFunctionContext(input) {
4306
- const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getCurrentEventState(
4588
+ const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getInMemoryEventState(
4307
4589
  input.validatorContext?.event,
4308
4590
  input.validatorContext?.eventConfig
4309
4591
  )?.flags : [];
@@ -4667,9 +4949,9 @@ function validatePlaceOfEvent(event2, ctx) {
4667
4949
  }
4668
4950
  function validateActionFlags(event2, ctx) {
4669
4951
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
4670
- const configuredFlagIds = event2.flags.map((flag) => flag.id);
4952
+ const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
4671
4953
  const actionFlagIds = event2.actions.flatMap(
4672
- (action) => (action.flags ?? []).map((flag) => flag.id)
4954
+ (action) => (action.flags ?? []).map((flag2) => flag2.id)
4673
4955
  );
4674
4956
  for (const actionFlagId of actionFlagIds) {
4675
4957
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -4705,11 +4987,11 @@ function validateActionOrder(event2, ctx) {
4705
4987
  }
4706
4988
 
4707
4989
  // ../commons/src/events/EventConfig.ts
4708
- var EventFieldReference = z33.object({ $$event: EventMetadataDateFieldIdInput }).describe(
4990
+ var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
4709
4991
  "Reference to a field defined in the event metadata, using the field id."
4710
4992
  );
4711
- var _EventConfigBase = z33.object({
4712
- id: z33.string().describe(
4993
+ var _EventConfigBase = z34.object({
4994
+ id: z34.string().describe(
4713
4995
  'Machine-readable identifier of the event (e.g. "birth", "death").'
4714
4996
  ),
4715
4997
  dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
@@ -4728,23 +5010,26 @@ var _EventConfigBase = z33.object({
4728
5010
  "Summary information displayed in the event overview."
4729
5011
  ),
4730
5012
  label: TranslationConfig.describe("Human-readable label for the event type."),
4731
- actions: z33.array(ActionConfig).describe(
5013
+ actions: z34.array(ActionConfig).describe(
4732
5014
  "Configuration of core and custom actions associated with the event."
4733
5015
  ),
4734
- actionOrder: z33.array(z33.string()).optional().describe(
5016
+ actionOrder: z34.array(z34.string()).optional().describe(
4735
5017
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
4736
5018
  ),
4737
5019
  declaration: DeclarationFormConfig.describe(
4738
5020
  "Configuration of the form used to gather event data."
4739
5021
  ),
4740
- advancedSearch: z33.array(AdvancedSearchConfig).optional().default([]).describe(
5022
+ advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
4741
5023
  "Configuration of fields available in the advanced search feature."
4742
5024
  ),
4743
- flags: z33.array(FlagConfig).optional().default([]).describe(
5025
+ flags: z34.array(FlagConfig).optional().default([]).describe(
4744
5026
  "Configuration of custom flags associated with the actions of this event type."
4745
5027
  ),
4746
- analytics: z33.boolean().optional().default(true).describe(
5028
+ analytics: z34.boolean().optional().default(true).describe(
4747
5029
  "Indicates whether the records of this event type are included in analytics"
5030
+ ),
5031
+ icon: z34.partialRecord(AvailableIcons, Conditional).optional().describe(
5032
+ '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.'
4748
5033
  )
4749
5034
  });
4750
5035
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
@@ -4961,21 +5246,31 @@ var event = Object.assign(eventFn, {
4961
5246
  return {
4962
5247
  $event: field3
4963
5248
  };
4964
- }
5249
+ },
5250
+ /**
5251
+ * Checks if the event currently has the given status.
5252
+ * @param eventStatus - The status to check for.
5253
+ */
5254
+ hasStatus: (eventStatus) => status(eventStatus),
5255
+ /**
5256
+ * Checks if the event currently carries the given flag.
5257
+ * @param flagValue - The flag to check for.
5258
+ */
5259
+ hasFlag: (flagValue) => flag(flagValue)
4965
5260
  });
4966
5261
 
4967
5262
  // ../commons/src/events/WorkqueueColumnConfig.ts
4968
- var z34 = __toESM(require("zod/v4"));
5263
+ var z35 = __toESM(require("zod/v4"));
4969
5264
  var WorkqueueColumnKeysArray = [
4970
5265
  ...EventMetadataKeysArray,
4971
5266
  "title",
4972
5267
  "outbox"
4973
5268
  ];
4974
- var WorkqueueColumnKeys = z34.enum(WorkqueueColumnKeysArray);
4975
- var WorkqueueColumnValue = z34.object({
5269
+ var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
5270
+ var WorkqueueColumnValue = z35.object({
4976
5271
  $event: WorkqueueColumnKeys
4977
5272
  });
4978
- var WorkqueueColumn = z34.object({
5273
+ var WorkqueueColumn = z35.object({
4979
5274
  label: TranslationConfig,
4980
5275
  value: WorkqueueColumnValue
4981
5276
  }).meta({
@@ -4989,164 +5284,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
4989
5284
  }
4990
5285
 
4991
5286
  // ../commons/src/events/CountryConfigQueryInput.ts
4992
- var z35 = __toESM(require("zod/v4"));
4993
- var SerializableExact = z35.object({
4994
- type: z35.literal("exact"),
4995
- term: z35.union([z35.string(), SerializedUserField])
4996
- });
4997
- var SerializableWithin = z35.object({
4998
- type: z35.literal("within"),
4999
- location: z35.union([z35.string(), SerializedUserField])
5000
- });
5001
- var SerializedQueryExpression = z35.object({
5002
- eventType: z35.string(),
5003
- status: z35.optional(z35.union([AnyOfStatus, ExactStatus])),
5004
- createdAt: z35.optional(DateCondition),
5005
- updatedAt: z35.optional(DateCondition),
5006
- "legalStatuses.DECLARED.createdAtLocation": z35.optional(SerializableWithin),
5007
- "legalStatuses.DECLARED.createdByRole": z35.optional(AnyOf),
5008
- "legalStatuses.REGISTERED.createdAt": z35.optional(DateCondition),
5009
- "legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
5010
- "legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
5011
- "legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
5012
- createdAtLocation: z35.optional(
5013
- z35.union([SerializableWithin, SerializableExact])
5287
+ var z36 = __toESM(require("zod/v4"));
5288
+ var SerializableExact = z36.object({
5289
+ type: z36.literal("exact"),
5290
+ term: z36.union([z36.string(), SerializedUserField])
5291
+ });
5292
+ var SerializableWithin = z36.object({
5293
+ type: z36.literal("within"),
5294
+ location: z36.union([z36.string(), SerializedUserField])
5295
+ });
5296
+ var SerializedQueryExpression = z36.object({
5297
+ eventType: z36.string(),
5298
+ status: z36.optional(z36.union([AnyOfStatus, ExactStatus])),
5299
+ createdAt: z36.optional(DateCondition),
5300
+ updatedAt: z36.optional(DateCondition),
5301
+ "legalStatuses.DECLARED.createdAtLocation": z36.optional(SerializableWithin),
5302
+ "legalStatuses.DECLARED.createdByRole": z36.optional(AnyOf),
5303
+ "legalStatuses.REGISTERED.createdAt": z36.optional(DateCondition),
5304
+ "legalStatuses.REGISTERED.createdAtLocation": z36.optional(SerializableWithin),
5305
+ "legalStatuses.REGISTERED.createdByRole": z36.optional(AnyOf),
5306
+ "legalStatuses.REGISTERED.registrationNumber": z36.optional(Exact),
5307
+ createdAtLocation: z36.optional(
5308
+ z36.union([SerializableWithin, SerializableExact])
5014
5309
  ),
5015
- updatedAtLocation: z35.optional(
5016
- z35.union([SerializableWithin, SerializableExact])
5310
+ updatedAtLocation: z36.optional(
5311
+ z36.union([SerializableWithin, SerializableExact])
5017
5312
  ),
5018
- updatedByUserRole: z35.optional(SerializableExact),
5019
- assignedTo: z35.optional(SerializableExact),
5020
- createdBy: z35.optional(SerializableExact),
5313
+ updatedByUserRole: z36.optional(SerializableExact),
5314
+ assignedTo: z36.optional(SerializableExact),
5315
+ createdBy: z36.optional(SerializableExact),
5021
5316
  createdByUserType: ExactUserType,
5022
- updatedBy: z35.optional(SerializableExact),
5023
- trackingId: z35.optional(Exact),
5024
- flags: z35.optional(ContainsFlags),
5317
+ updatedBy: z36.optional(SerializableExact),
5318
+ trackingId: z36.optional(Exact),
5319
+ flags: z36.optional(ContainsFlags),
5025
5320
  data: QueryInput
5026
5321
  }).partial();
5027
- var Or2 = z35.object({
5028
- type: z35.literal("or"),
5029
- clauses: z35.array(SerializedQueryExpression)
5322
+ var Or2 = z36.object({
5323
+ type: z36.literal("or"),
5324
+ clauses: z36.array(SerializedQueryExpression)
5030
5325
  });
5031
- var And2 = z35.object({
5032
- type: z35.literal("and"),
5033
- clauses: z35.array(SerializedQueryExpression)
5326
+ var And2 = z36.object({
5327
+ type: z36.literal("and"),
5328
+ clauses: z36.array(SerializedQueryExpression)
5034
5329
  });
5035
- var CountryConfigQueryType = z35.discriminatedUnion("type", [And2, Or2]);
5036
- var CountryConfigQueryInputType = z35.union([
5330
+ var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
5331
+ var CountryConfigQueryInputType = z36.union([
5037
5332
  SerializedQueryExpression,
5038
5333
  And2,
5039
5334
  Or2
5040
5335
  ]);
5041
5336
 
5042
- // ../commons/src/icons.ts
5043
- var z36 = __toESM(require("zod/v4"));
5044
- var AvailableIcons = z36.enum([
5045
- "Archived",
5046
- "Assigned",
5047
- "Briefcase",
5048
- "Certified",
5049
- "Close",
5050
- "Collapse",
5051
- "Draft",
5052
- "DuplicateYellow",
5053
- "Expand",
5054
- "ExternalValidate",
5055
- "FilledCheck",
5056
- "InReview",
5057
- "Offline",
5058
- "Registered",
5059
- "RequiresUpdates",
5060
- "Sent",
5061
- "Validated",
5062
- "WaitingApproval",
5063
- "ChartActivity",
5064
- "Activity",
5065
- "Archive",
5066
- "ArchiveTray",
5067
- "ArrowLeft",
5068
- "ArrowRight",
5069
- "Buildings",
5070
- "Circle",
5071
- "CaretDown",
5072
- "CaretLeft",
5073
- "CaretRight",
5074
- "ChartBar",
5075
- "ChartLine",
5076
- "ChatCircle",
5077
- "CheckSquare",
5078
- "Compass",
5079
- "Check",
5080
- "Copy",
5081
- "Database",
5082
- "DotsThreeVertical",
5083
- "ArrowCounterClockwise",
5084
- "MagnifyingGlassMinus",
5085
- "MagnifyingGlassPlus",
5086
- "Export",
5087
- "Eye",
5088
- "EyeSlash",
5089
- "Envelope",
5090
- "File",
5091
- "FileSearch",
5092
- "FileMinus",
5093
- "FilePlus",
5094
- "FileText",
5095
- "FileX",
5096
- "Handshake",
5097
- "Gear",
5098
- "GitBranch",
5099
- "IdentificationCard",
5100
- "List",
5101
- "ListBullets",
5102
- "Lock",
5103
- "MagnifyingGlass",
5104
- "MapPin",
5105
- "Medal",
5106
- "NotePencil",
5107
- "Paperclip",
5108
- "PaperPlaneTilt",
5109
- "Pen",
5110
- "PenNib",
5111
- "Pencil",
5112
- "PencilSimpleLine",
5113
- "Phone",
5114
- "Plus",
5115
- "Printer",
5116
- "SignOut",
5117
- "Stamp",
5118
- "Star",
5119
- "Target",
5120
- "TextT",
5121
- "Trash",
5122
- "UploadSimple",
5123
- "User",
5124
- "UserPlus",
5125
- "Users",
5126
- "WarningCircle",
5127
- "X",
5128
- "ChatText",
5129
- "CircleWavyCheck",
5130
- "CircleWavyQuestion",
5131
- "ArchiveBox",
5132
- "ArrowCircleDown",
5133
- "FileArrowUp",
5134
- "FileDotted",
5135
- "Files",
5136
- "PencilLine",
5137
- "PencilCircle",
5138
- "UserCircle",
5139
- "Clock",
5140
- "QrCode",
5141
- "Webcam",
5142
- "Sun",
5143
- "DeviceTabletCamera",
5144
- "Globe",
5145
- "Fingerprint",
5146
- "PushPin",
5147
- "Timer"
5148
- ]);
5149
-
5150
5337
  // ../commons/src/events/WorkqueueConfig.ts
5151
5338
  var mandatoryColumns = defineWorkqueuesColumns([
5152
5339
  {
@@ -7922,21 +8109,69 @@ var LocationTypeV1 = z43.enum([
7922
8109
  "CRVS_OFFICE",
7923
8110
  "HEALTH_FACILITY"
7924
8111
  ]);
8112
+ var LocationStatus = z43.enum(["active", "inactive"]);
8113
+ var LocationVersion = z43.object({
8114
+ versionId: UUID,
8115
+ effectiveFrom: z43.iso.date(),
8116
+ name: z43.string(),
8117
+ externalId: z43.string().nullish(),
8118
+ status: LocationStatus
8119
+ });
7925
8120
  var AdministrativeArea = z43.object({
7926
8121
  id: UUID,
7927
8122
  name: z43.string(),
7928
8123
  externalId: z43.string().nullish(),
7929
8124
  parentId: UUID.nullable(),
7930
- validUntil: z43.iso.datetime().nullable()
8125
+ status: LocationStatus,
8126
+ versions: z43.array(LocationVersion)
7931
8127
  });
7932
8128
  var Location = z43.object({
7933
8129
  id: UUID,
7934
8130
  name: z43.string(),
7935
8131
  externalId: z43.string().nullish(),
7936
8132
  administrativeAreaId: UUID.nullable(),
7937
- validUntil: z43.iso.datetime().nullable(),
8133
+ locationType: z43.string().nullable(),
8134
+ status: LocationStatus,
8135
+ versions: z43.array(LocationVersion)
8136
+ });
8137
+ var ClientAdministrativeArea = AdministrativeArea.omit({
8138
+ name: true,
8139
+ status: true,
8140
+ externalId: true
8141
+ });
8142
+ var ClientLocation = Location.omit({
8143
+ name: true,
8144
+ status: true,
8145
+ externalId: true
8146
+ });
8147
+ function toClientLocation(location) {
8148
+ return {
8149
+ id: location.id,
8150
+ administrativeAreaId: location.administrativeAreaId,
8151
+ locationType: location.locationType,
8152
+ versions: location.versions
8153
+ };
8154
+ }
8155
+ function toClientAdministrativeArea(area) {
8156
+ return {
8157
+ id: area.id,
8158
+ parentId: area.parentId,
8159
+ versions: area.versions
8160
+ };
8161
+ }
8162
+ var SetLocationPayload = z43.object({
8163
+ id: UUID,
8164
+ name: z43.string(),
8165
+ externalId: z43.string().nullish(),
8166
+ administrativeAreaId: UUID.nullable(),
7938
8167
  locationType: z43.string().nullable()
7939
8168
  });
8169
+ var SetAdministrativeAreaPayload = z43.object({
8170
+ id: UUID,
8171
+ name: z43.string(),
8172
+ externalId: z43.string().nullish(),
8173
+ parentId: UUID.nullable()
8174
+ });
7940
8175
 
7941
8176
  // ../commons/src/events/scopes.ts
7942
8177
  var ACTION_SCOPE_MAP = {
@@ -8008,20 +8243,20 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8008
8243
  ]
8009
8244
  };
8010
8245
  var ACTION_FILTERS = {
8011
- [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8012
- [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8013
- [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8014
- [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8015
- [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8016
- [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
8017
- [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
8018
- [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
8019
- [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
8020
- [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
8021
- [ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
8022
- [ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
8023
- [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
8024
- [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
8246
+ [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8247
+ [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8248
+ [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8249
+ [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8250
+ [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8251
+ [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8252
+ [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8253
+ [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8254
+ [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8255
+ [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8256
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8257
+ [ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8258
+ [ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8259
+ [ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
8025
8260
  };
8026
8261
  var REJECTED_ACTIONS = [
8027
8262
  ActionType.READ,
@@ -8035,75 +8270,80 @@ var REJECTED_ACTIONS = [
8035
8270
  var import_lodash7 = require("lodash");
8036
8271
 
8037
8272
  // ../commons/src/events/mocks.test.utils.ts
8038
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
8273
+ function withVersionFields(entity) {
8274
+ return {
8275
+ ...entity,
8276
+ status: "active",
8277
+ versions: [
8278
+ {
8279
+ versionId: entity.id,
8280
+ effectiveFrom: "0001-01-01",
8281
+ name: entity.name,
8282
+ externalId: entity.externalId ?? null,
8283
+ status: "active"
8284
+ }
8285
+ ]
8286
+ };
8287
+ }
8288
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
8039
8289
  {
8040
8290
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8041
8291
  name: "Central",
8042
8292
  parentId: null,
8043
- validUntil: null,
8044
8293
  externalId: "ydyJb1RAy4U1"
8045
8294
  },
8046
8295
  {
8047
8296
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
8048
8297
  name: "Sulaka",
8049
8298
  parentId: null,
8050
- validUntil: null,
8051
8299
  externalId: "pQ8nGxWmZ2Q3"
8052
8300
  },
8053
8301
  {
8054
8302
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
8055
8303
  name: "Pualula",
8056
8304
  parentId: null,
8057
- validUntil: null,
8058
8305
  externalId: "Aq91DweLmT8k"
8059
8306
  },
8060
8307
  {
8061
8308
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
8062
8309
  name: "Chuminga",
8063
8310
  parentId: null,
8064
- validUntil: null,
8065
8311
  externalId: "Rw0fYNh2Xk9a"
8066
8312
  },
8067
8313
  {
8068
8314
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8069
8315
  name: "Ibombo",
8070
8316
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8071
- validUntil: null,
8072
8317
  externalId: "k7DsP4vbN1Qe"
8073
8318
  },
8074
8319
  {
8075
8320
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
8076
8321
  name: "Isango",
8077
8322
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8078
- validUntil: null,
8079
8323
  externalId: "Gm3Z9eQpHw4L"
8080
8324
  },
8081
8325
  {
8082
8326
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
8083
8327
  name: "Isamba",
8084
8328
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8085
- validUntil: null,
8086
8329
  externalId: "sT0xVu1KqJ7r"
8087
8330
  },
8088
8331
  {
8089
8332
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
8090
8333
  name: "Itambo",
8091
8334
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8092
- validUntil: null,
8093
8335
  externalId: "Nq6Bv2HpL9Te"
8094
8336
  },
8095
8337
  {
8096
8338
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
8097
8339
  name: "Ezhi",
8098
8340
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8099
- validUntil: null,
8100
8341
  externalId: "xK8cQ0ZRy5Wd"
8101
8342
  },
8102
8343
  {
8103
8344
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
8104
8345
  name: "Ilanga",
8105
8346
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
8106
- validUntil: null,
8107
8347
  externalId: "Cq4Jm1XvN8Ls"
8108
8348
  },
8109
8349
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -8111,49 +8351,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
8111
8351
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
8112
8352
  name: "Klow",
8113
8353
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8114
- validUntil: null,
8115
8354
  externalId: "IkYcYBUcyY2"
8116
8355
  },
8117
8356
  {
8118
8357
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
8119
8358
  name: "Mbondo",
8120
8359
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8121
- validUntil: null,
8122
8360
  externalId: "Qhvv5hvo3mY"
8123
8361
  },
8124
8362
  {
8125
8363
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
8126
8364
  name: "Ndara",
8127
8365
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8128
- validUntil: null,
8129
8366
  externalId: "crXh068O9TR"
8130
8367
  },
8131
8368
  {
8132
8369
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
8133
8370
  name: "Olani",
8134
8371
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8135
- validUntil: null,
8136
8372
  externalId: "r00It8Tvvp7"
8137
8373
  },
8138
8374
  {
8139
8375
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
8140
8376
  name: "Pemba",
8141
8377
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8142
- validUntil: null,
8143
8378
  externalId: "ZnUWsbONIaH"
8144
8379
  },
8145
8380
  {
8146
8381
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
8147
8382
  name: "Quanza",
8148
8383
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8149
- validUntil: null,
8150
8384
  externalId: "fDZycvQTa7l"
8151
8385
  },
8152
8386
  {
8153
8387
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
8154
8388
  name: "Rivka",
8155
8389
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8156
- validUntil: null,
8157
8390
  externalId: "KqswxCGTELa"
8158
8391
  },
8159
8392
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -8161,35 +8394,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
8161
8394
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
8162
8395
  name: "Mbula",
8163
8396
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
8164
- validUntil: null,
8165
8397
  externalId: "osEbKjRc9Kg"
8166
8398
  },
8167
8399
  {
8168
8400
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
8169
8401
  name: "Ndoki",
8170
8402
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
8171
- validUntil: null,
8172
8403
  externalId: "aq4daBUAGr3"
8173
8404
  },
8174
8405
  {
8175
8406
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
8176
8407
  name: "Tsanga",
8177
8408
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
8178
- validUntil: null,
8179
8409
  externalId: "cqis6Y8trbJ"
8180
8410
  },
8181
8411
  {
8182
8412
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
8183
8413
  name: "Waziri",
8184
8414
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
8185
- validUntil: null,
8186
8415
  externalId: "LMijHPyyx6d"
8187
8416
  },
8188
8417
  {
8189
8418
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
8190
8419
  name: "Zimbi",
8191
8420
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
8192
- validUntil: null,
8193
8421
  externalId: "pcQYbPuKGZ7"
8194
8422
  },
8195
8423
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -8197,67 +8425,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
8197
8425
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
8198
8426
  name: "Felani",
8199
8427
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
8200
- validUntil: null,
8201
8428
  externalId: "gSqpoCGdMXp"
8202
8429
  },
8203
8430
  {
8204
8431
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
8205
8432
  name: "Goroma",
8206
8433
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
8207
- validUntil: null,
8208
8434
  externalId: "KvAAIaNqVrp"
8209
8435
  },
8210
8436
  {
8211
8437
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
8212
8438
  name: "Halifu",
8213
8439
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
8214
- validUntil: null,
8215
8440
  externalId: "qe4UnEVt1hv"
8216
8441
  },
8217
8442
  {
8218
8443
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
8219
8444
  name: "Jabari",
8220
8445
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
8221
- validUntil: null,
8222
8446
  externalId: "yHH9Nz4rLOt"
8223
8447
  },
8224
8448
  {
8225
8449
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
8226
8450
  name: "Kifani",
8227
8451
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
8228
- validUntil: null,
8229
8452
  externalId: "eSWmXIGeu1I"
8230
8453
  },
8231
8454
  {
8232
8455
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
8233
8456
  name: "Lumela",
8234
8457
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
8235
- validUntil: null,
8236
8458
  externalId: "bh0b3aI1uP3"
8237
8459
  }
8238
8460
  ];
8239
- var V2_DEFAULT_MOCK_LOCATIONS = [
8461
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
8462
+ var MOCK_LOCATIONS_BASE = [
8240
8463
  {
8241
8464
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
8242
8465
  name: "Central Provincial Office",
8243
8466
  locationType: "CRVS_OFFICE",
8244
8467
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8245
- validUntil: null,
8246
8468
  externalId: "Xr3Df8WpK6Ys"
8247
8469
  },
8248
8470
  {
8249
8471
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
8250
8472
  name: "Central Health Post",
8251
8473
  locationType: "HEALTH_FACILITY",
8252
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8253
- validUntil: null
8474
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
8254
8475
  },
8255
8476
  {
8256
8477
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
8257
8478
  name: "Ibombo District Office",
8258
8479
  locationType: "CRVS_OFFICE",
8259
8480
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8260
- validUntil: null,
8261
8481
  externalId: "Sm4Nw7GrD2Vy"
8262
8482
  },
8263
8483
  {
@@ -8265,7 +8485,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8265
8485
  name: "Isamba District Office",
8266
8486
  locationType: "CRVS_OFFICE",
8267
8487
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
8268
- validUntil: null,
8269
8488
  externalId: "Vg1Bq5XeH9Lt"
8270
8489
  },
8271
8490
  {
@@ -8273,7 +8492,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8273
8492
  name: "Isango District Office",
8274
8493
  locationType: "CRVS_OFFICE",
8275
8494
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
8276
- validUntil: null,
8277
8495
  externalId: "Je7Lm2XqN9Vz"
8278
8496
  },
8279
8497
  {
@@ -8281,7 +8499,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8281
8499
  name: "Sulaka Provincial Office",
8282
8500
  locationType: "CRVS_OFFICE",
8283
8501
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
8284
- validUntil: null,
8285
8502
  externalId: "Ht2Wp9KcX5Qv"
8286
8503
  },
8287
8504
  {
@@ -8289,7 +8506,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8289
8506
  name: "Ilanga District Office",
8290
8507
  locationType: "CRVS_OFFICE",
8291
8508
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
8292
- validUntil: null,
8293
8509
  externalId: "Yp6Ds1WqN3Xz"
8294
8510
  },
8295
8511
  {
@@ -8297,7 +8513,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8297
8513
  name: "Chamakubi Health Post",
8298
8514
  locationType: "HEALTH_FACILITY",
8299
8515
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8300
- validUntil: null,
8301
8516
  externalId: "M1nFr8LbC2Qy"
8302
8517
  },
8303
8518
  {
@@ -8305,7 +8520,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8305
8520
  name: "Ibombo Rural Health Centre",
8306
8521
  locationType: "HEALTH_FACILITY",
8307
8522
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8308
- validUntil: null,
8309
8523
  externalId: "bT7pV6YrW0Xc"
8310
8524
  },
8311
8525
  {
@@ -8313,7 +8527,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8313
8527
  name: "Chikobo Rural Health Centre",
8314
8528
  locationType: "HEALTH_FACILITY",
8315
8529
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8316
- validUntil: null,
8317
8530
  externalId: "zE4qPn2SgJ5d"
8318
8531
  },
8319
8532
  {
@@ -8321,7 +8534,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8321
8534
  name: "Chilochabalenje Health Post",
8322
8535
  locationType: "HEALTH_FACILITY",
8323
8536
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8324
- validUntil: null,
8325
8537
  externalId: "H8vDs1MqR4Uf"
8326
8538
  },
8327
8539
  {
@@ -8329,7 +8541,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8329
8541
  name: "Chipeso Rural Health Centre",
8330
8542
  locationType: "HEALTH_FACILITY",
8331
8543
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8332
- validUntil: null,
8333
8544
  externalId: "Qw3uZ9KfX6Lm"
8334
8545
  },
8335
8546
  {
@@ -8337,7 +8548,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8337
8548
  name: "Chisamba Rural Health Centre",
8338
8549
  locationType: "HEALTH_FACILITY",
8339
8550
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8340
- validUntil: null,
8341
8551
  externalId: "Yr0pCg8LdM2s"
8342
8552
  },
8343
8553
  {
@@ -8345,7 +8555,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8345
8555
  name: "Chitanda Rural Health Centre",
8346
8556
  locationType: "HEALTH_FACILITY",
8347
8557
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8348
- validUntil: null,
8349
8558
  externalId: "tS9gJ4PwB1Qx"
8350
8559
  },
8351
8560
  {
@@ -8353,7 +8562,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8353
8562
  name: "Golden Valley Rural Health Centre",
8354
8563
  locationType: "HEALTH_FACILITY",
8355
8564
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8356
- validUntil: null,
8357
8565
  externalId: "Ld7Qm3XsA8Vr"
8358
8566
  },
8359
8567
  {
@@ -8361,7 +8569,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8361
8569
  name: "Ipongo Rural Health Centre",
8362
8570
  locationType: "HEALTH_FACILITY",
8363
8571
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8364
- validUntil: null,
8365
8572
  externalId: "kF2sW9DmH0Bt"
8366
8573
  },
8367
8574
  {
@@ -8369,7 +8576,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8369
8576
  name: "Itumbwe Health Post",
8370
8577
  locationType: "HEALTH_FACILITY",
8371
8578
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8372
- validUntil: null,
8373
8579
  externalId: "Ue5Xb3VaC7Pq"
8374
8580
  },
8375
8581
  {
@@ -8377,7 +8583,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8377
8583
  name: "Kabangalala Rural Health Centre",
8378
8584
  locationType: "HEALTH_FACILITY",
8379
8585
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
8380
- validUntil: null,
8381
8586
  externalId: "Pz8Kc1TqH6Jn"
8382
8587
  },
8383
8588
  // Village offices
@@ -8386,19 +8591,76 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
8386
8591
  name: "Klow Village Office",
8387
8592
  locationType: "CRVS_OFFICE",
8388
8593
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
8389
- validUntil: null,
8390
8594
  externalId: "PmAyxAJkxiJ"
8391
8595
  }
8392
8596
  ];
8597
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
8393
8598
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
8394
8599
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
8395
8600
  );
8396
8601
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
8397
8602
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
8398
8603
  );
8604
+ var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
8605
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
8606
+ );
8607
+ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
8608
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
8609
+ a.id,
8610
+ toClientAdministrativeArea(a)
8611
+ ])
8612
+ );
8399
8613
 
8400
- // ../commons/src/notification/UserNotifications.ts
8614
+ // ../commons/src/events/locationPayloads.ts
8401
8615
  var z44 = __toESM(require("zod/v4"));
8616
+ var CreateLocationPayload = z44.object({
8617
+ id: UUID.optional(),
8618
+ versionId: UUID.optional(),
8619
+ name: z44.string(),
8620
+ externalId: z44.string().nullish(),
8621
+ administrativeAreaId: UUID.nullable(),
8622
+ locationType: z44.string().nullable(),
8623
+ effectiveFrom: z44.iso.date().optional(),
8624
+ status: LocationStatus.default("active")
8625
+ });
8626
+ var UpdateLocationPayload = z44.strictObject({
8627
+ id: UUID,
8628
+ versionId: UUID.optional(),
8629
+ name: z44.string(),
8630
+ externalId: z44.string().nullish(),
8631
+ status: LocationStatus,
8632
+ effectiveFrom: z44.iso.date().optional(),
8633
+ lastVersionId: UUID
8634
+ });
8635
+ var WithdrawLocationVersionPayload = z44.object({
8636
+ id: UUID,
8637
+ versionId: UUID
8638
+ });
8639
+ var CreateAdministrativeAreaPayload = z44.object({
8640
+ id: UUID.optional(),
8641
+ versionId: UUID.optional(),
8642
+ name: z44.string(),
8643
+ externalId: z44.string().nullish(),
8644
+ parentId: UUID.nullable(),
8645
+ effectiveFrom: z44.iso.date().optional(),
8646
+ status: LocationStatus.default("active")
8647
+ });
8648
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
8649
+ id: UUID,
8650
+ versionId: UUID.optional(),
8651
+ name: z44.string(),
8652
+ externalId: z44.string().nullish(),
8653
+ status: LocationStatus,
8654
+ effectiveFrom: z44.iso.date().optional(),
8655
+ lastVersionId: UUID
8656
+ });
8657
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
8658
+ id: UUID,
8659
+ versionId: UUID
8660
+ });
8661
+
8662
+ // ../commons/src/notification/UserNotifications.ts
8663
+ var z45 = __toESM(require("zod/v4"));
8402
8664
  var TriggerEvent = {
8403
8665
  USER_CREATED: "user-created",
8404
8666
  USER_UPDATED: "user-updated",
@@ -8411,54 +8673,54 @@ var TriggerEvent = {
8411
8673
  CHANGE_PHONE_NUMBER: "change-phone-number",
8412
8674
  CHANGE_EMAIL_ADDRESS: "change-email-address"
8413
8675
  };
8414
- var Recipient = z44.object({
8676
+ var Recipient = z45.object({
8415
8677
  name: NameFieldValue.optional(),
8416
- mobile: z44.string().optional(),
8417
- email: z44.string().optional(),
8418
- bcc: z44.array(z44.string()).optional()
8678
+ mobile: z45.string().optional(),
8679
+ email: z45.string().optional(),
8680
+ bcc: z45.array(z45.string()).optional()
8419
8681
  });
8420
- var BasePayload = z44.object({
8682
+ var BasePayload = z45.object({
8421
8683
  recipient: Recipient
8422
8684
  });
8423
8685
  var TriggerPayload = {
8424
8686
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
8425
- username: z44.string(),
8426
- temporaryPassword: z44.string()
8687
+ username: z45.string(),
8688
+ temporaryPassword: z45.string()
8427
8689
  }),
8428
8690
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
8429
- oldUsername: z44.string(),
8430
- newUsername: z44.string()
8691
+ oldUsername: z45.string(),
8692
+ newUsername: z45.string()
8431
8693
  }),
8432
8694
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
8433
- username: z44.string()
8695
+ username: z45.string()
8434
8696
  }),
8435
8697
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
8436
- code: z44.string()
8698
+ code: z45.string()
8437
8699
  }),
8438
8700
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
8439
- temporaryPassword: z44.string(),
8440
- admin: z44.object({
8441
- id: z44.string(),
8701
+ temporaryPassword: z45.string(),
8702
+ admin: z45.object({
8703
+ id: z45.string(),
8442
8704
  name: NameFieldValue,
8443
- role: z44.string()
8705
+ role: z45.string()
8444
8706
  })
8445
8707
  }),
8446
8708
  [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
8447
- username: z44.string(),
8448
- temporaryPassword: z44.string()
8709
+ username: z45.string(),
8710
+ temporaryPassword: z45.string()
8449
8711
  }),
8450
8712
  [TriggerEvent.TWO_FA]: BasePayload.extend({
8451
- code: z44.string()
8713
+ code: z45.string()
8452
8714
  }),
8453
8715
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
8454
- subject: z44.string(),
8455
- body: z44.string()
8716
+ subject: z45.string(),
8717
+ body: z45.string()
8456
8718
  }),
8457
8719
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
8458
- code: z44.string()
8720
+ code: z45.string()
8459
8721
  }),
8460
8722
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
8461
- code: z44.string()
8723
+ code: z45.string()
8462
8724
  })
8463
8725
  };
8464
8726
  async function triggerUserEventNotification({
@@ -8482,4 +8744,4 @@ function parseUserEventTrigger(event2, body) {
8482
8744
  }
8483
8745
 
8484
8746
  // src/notification/index.ts
8485
- z45.globalRegistry.clear();
8747
+ z46.globalRegistry.clear();