@opencrvs/toolkit 2.1.0-rc.4744ac9 → 2.1.0-rc.47be1be

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.
@@ -80,6 +80,8 @@ __export(events_exports, {
80
80
  ConditionalType: () => ConditionalType,
81
81
  ConfirmableActions: () => ConfirmableActions,
82
82
  ContainsFlags: () => ContainsFlags,
83
+ CreateAdministrativeAreaPayload: () => CreateAdministrativeAreaPayload,
84
+ CreateLocationPayload: () => CreateLocationPayload,
83
85
  CustomActionInput: () => CustomActionInput,
84
86
  CustomFieldValue: () => CustomFieldValue,
85
87
  CustomFlag: () => CustomFlag,
@@ -161,7 +163,9 @@ __export(events_exports, {
161
163
  LanguageConfig: () => LanguageConfig,
162
164
  LegalStatuses: () => LegalStatuses,
163
165
  Location: () => Location,
166
+ LocationStatus: () => LocationStatus,
164
167
  LocationTypeV1: () => LocationTypeV1,
168
+ LocationVersion: () => LocationVersion,
165
169
  METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
166
170
  MarkAsDuplicateActionInput: () => MarkAsDuplicateActionInput,
167
171
  MarkNotDuplicateActionInput: () => MarkNotDuplicateActionInput,
@@ -201,6 +205,8 @@ __export(events_exports, {
201
205
  SelectDateRangeOption: () => SelectDateRangeOption,
202
206
  SelectDateRangeValue: () => SelectDateRangeValue,
203
207
  SelectOption: () => SelectOption,
208
+ SetAdministrativeAreaPayload: () => SetAdministrativeAreaPayload,
209
+ SetLocationPayload: () => SetLocationPayload,
204
210
  ShowConditional: () => ShowConditional,
205
211
  SignatureFieldValue: () => SignatureFieldValue,
206
212
  StaticDataEntry: () => StaticDataEntry,
@@ -216,6 +222,8 @@ __export(events_exports, {
216
222
  UUID: () => UUID,
217
223
  UnarchiveActionInput: () => UnarchiveActionInput,
218
224
  UnassignActionInput: () => UnassignActionInput,
225
+ UpdateAdministrativeAreaPayload: () => UpdateAdministrativeAreaPayload,
226
+ UpdateLocationPayload: () => UpdateLocationPayload,
219
227
  UserAuditRecordInput: () => UserAuditRecordInput,
220
228
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
221
229
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP,
@@ -225,6 +233,8 @@ __export(events_exports, {
225
233
  VerificationActionConfig: () => VerificationActionConfig,
226
234
  VerificationPageConfig: () => VerificationPageConfig,
227
235
  VerificationStatusValue: () => VerificationStatusValue,
236
+ WithdrawAdministrativeAreaVersionPayload: () => WithdrawAdministrativeAreaVersionPayload,
237
+ WithdrawLocationVersionPayload: () => WithdrawLocationVersionPayload,
228
238
  Within: () => Within,
229
239
  WorkqueueActionType: () => WorkqueueActionType,
230
240
  WorkqueueColumn: () => WorkqueueColumn,
@@ -343,6 +353,7 @@ __export(events_exports, {
343
353
  getStatusFromActions: () => getStatusFromActions,
344
354
  getValidatorsForField: () => getValidatorsForField,
345
355
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
356
+ hasActiveExternalIdOnOrAfter: () => hasActiveExternalIdOnOrAfter,
346
357
  hasAnyOfScopes: () => hasAnyOfScopes,
347
358
  isActionAvailable: () => isActionAvailable,
348
359
  isActionConfigType: () => isActionConfigType,
@@ -433,6 +444,7 @@ __export(events_exports, {
433
444
  resolveDateOfEvent: () => resolveDateOfEvent,
434
445
  resolveEventCustomFlags: () => resolveEventCustomFlags,
435
446
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
447
+ resolveVersion: () => resolveVersion,
436
448
  runClientFunction: () => runClientFunction,
437
449
  runFieldValidations: () => runFieldValidations,
438
450
  runStructuralValidations: () => runStructuralValidations,
@@ -500,6 +512,7 @@ var PlainScopeType = z2.enum([
500
512
  "integration.create",
501
513
  "record.import",
502
514
  "config.update-all",
515
+ "location.edit",
503
516
  "attachment.upload",
504
517
  "profile.electronic-signature",
505
518
  "user.read-only-my-audit",
@@ -982,6 +995,62 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
982
995
  requestData: z5.object({ id: z5.string() }),
983
996
  responseSummary: z5.object({ clientId: z5.string() })
984
997
  });
998
+ var createdVersionFields = {
999
+ id: z5.string(),
1000
+ versionId: z5.string(),
1001
+ name: z5.string(),
1002
+ externalId: z5.string().nullish(),
1003
+ effectiveFrom: z5.string(),
1004
+ status: z5.string()
1005
+ };
1006
+ var LocationCreateEntrySchema = AuditLogEntryBase.extend({
1007
+ operation: z5.literal("locations.create"),
1008
+ requestData: z5.object({
1009
+ ...createdVersionFields,
1010
+ administrativeAreaId: z5.string().nullish(),
1011
+ locationType: z5.string().nullish()
1012
+ })
1013
+ });
1014
+ var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
1015
+ operation: z5.literal("administrativeAreas.create"),
1016
+ requestData: z5.object({
1017
+ ...createdVersionFields,
1018
+ parentId: z5.string().nullish()
1019
+ })
1020
+ });
1021
+ var ChangedStringField = z5.object({ from: z5.string(), to: z5.string() });
1022
+ var ChangedNullableStringField = z5.object({
1023
+ from: z5.string().nullable(),
1024
+ to: z5.string().nullable()
1025
+ });
1026
+ var updatedVersionRequestData = z5.object({
1027
+ id: z5.string(),
1028
+ versionId: z5.string(),
1029
+ name: z5.string(),
1030
+ externalId: z5.string().nullish(),
1031
+ status: z5.string(),
1032
+ effectiveFrom: z5.string(),
1033
+ lastVersionId: z5.string()
1034
+ });
1035
+ var updatedVersionResponseSummary = z5.object({
1036
+ previousVersionId: z5.string(),
1037
+ versionId: z5.string(),
1038
+ changed: z5.object({
1039
+ name: ChangedStringField.optional(),
1040
+ externalId: ChangedNullableStringField.optional(),
1041
+ status: ChangedStringField.optional()
1042
+ })
1043
+ });
1044
+ var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
1045
+ operation: z5.literal("locations.update"),
1046
+ requestData: updatedVersionRequestData,
1047
+ responseSummary: updatedVersionResponseSummary
1048
+ });
1049
+ var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
1050
+ operation: z5.literal("administrativeAreas.update"),
1051
+ requestData: updatedVersionRequestData,
1052
+ responseSummary: updatedVersionResponseSummary
1053
+ });
985
1054
  var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
986
1055
  operation: z5.literal("attachments.upload"),
987
1056
  requestData: z5.object({
@@ -1057,6 +1126,10 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
1057
1126
  IntegrationActivateEntrySchema,
1058
1127
  IntegrationDeleteEntrySchema,
1059
1128
  IntegrationRefreshSecretEntrySchema,
1129
+ LocationCreateEntrySchema,
1130
+ LocationUpdateEntrySchema,
1131
+ AdministrativeAreaUpdateEntrySchema,
1132
+ AdministrativeAreaCreateEntrySchema,
1060
1133
  AttachmentUploadEntrySchema,
1061
1134
  UserCreateEntrySchema,
1062
1135
  UserReasonEntrySchema,
@@ -10466,21 +10539,60 @@ var LocationTypeV1 = z43.enum([
10466
10539
  "CRVS_OFFICE",
10467
10540
  "HEALTH_FACILITY"
10468
10541
  ]);
10542
+ var LocationStatus = z43.enum(["active", "inactive"]);
10543
+ var LocationVersion = z43.object({
10544
+ versionId: UUID,
10545
+ effectiveFrom: z43.iso.date(),
10546
+ name: z43.string(),
10547
+ externalId: z43.string().nullish(),
10548
+ status: LocationStatus
10549
+ });
10469
10550
  var AdministrativeArea = z43.object({
10470
10551
  id: UUID,
10471
10552
  name: z43.string(),
10472
10553
  externalId: z43.string().nullish(),
10473
10554
  parentId: UUID.nullable(),
10474
- validUntil: z43.iso.datetime().nullable()
10555
+ status: LocationStatus,
10556
+ versions: z43.array(LocationVersion)
10475
10557
  });
10476
10558
  var Location = z43.object({
10477
10559
  id: UUID,
10478
10560
  name: z43.string(),
10479
10561
  externalId: z43.string().nullish(),
10480
10562
  administrativeAreaId: UUID.nullable(),
10481
- validUntil: z43.iso.datetime().nullable(),
10563
+ locationType: z43.string().nullable(),
10564
+ status: LocationStatus,
10565
+ versions: z43.array(LocationVersion)
10566
+ });
10567
+ var SetLocationPayload = z43.object({
10568
+ id: UUID,
10569
+ name: z43.string(),
10570
+ externalId: z43.string().nullish(),
10571
+ administrativeAreaId: UUID.nullable(),
10482
10572
  locationType: z43.string().nullable()
10483
10573
  });
10574
+ var SetAdministrativeAreaPayload = z43.object({
10575
+ id: UUID,
10576
+ name: z43.string(),
10577
+ externalId: z43.string().nullish(),
10578
+ parentId: UUID.nullable()
10579
+ });
10580
+ function resolveVersion(versions, anchor) {
10581
+ let resolved = versions[0];
10582
+ for (const version of versions) {
10583
+ if (version.effectiveFrom <= anchor) {
10584
+ resolved = version;
10585
+ }
10586
+ }
10587
+ return resolved;
10588
+ }
10589
+ function hasActiveExternalIdOnOrAfter(versions, externalId, anchor) {
10590
+ const inEffectAtAnchor = resolveVersion(versions, anchor);
10591
+ const laterVersions = versions.filter((v) => v.effectiveFrom > anchor);
10592
+ return [inEffectAtAnchor, ...laterVersions].some(
10593
+ (v) => v.externalId === externalId && v.status === "active"
10594
+ );
10595
+ }
10484
10596
  function matchesJurisdictionFilter(locationIds, filter, user2) {
10485
10597
  if (!locationIds) {
10486
10598
  return false;
@@ -10960,75 +11072,80 @@ function getFilePathsFromEvent(event2) {
10960
11072
  }
10961
11073
 
10962
11074
  // ../commons/src/events/mocks.test.utils.ts
10963
- var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11075
+ function withVersionFields(entity) {
11076
+ return {
11077
+ ...entity,
11078
+ status: "active",
11079
+ versions: [
11080
+ {
11081
+ versionId: entity.id,
11082
+ effectiveFrom: "0001-01-01",
11083
+ name: entity.name,
11084
+ externalId: entity.externalId ?? null,
11085
+ status: "active"
11086
+ }
11087
+ ]
11088
+ };
11089
+ }
11090
+ var MOCK_ADMINISTRATIVE_AREAS_BASE = [
10964
11091
  {
10965
11092
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10966
11093
  name: "Central",
10967
11094
  parentId: null,
10968
- validUntil: null,
10969
11095
  externalId: "ydyJb1RAy4U1"
10970
11096
  },
10971
11097
  {
10972
11098
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10973
11099
  name: "Sulaka",
10974
11100
  parentId: null,
10975
- validUntil: null,
10976
11101
  externalId: "pQ8nGxWmZ2Q3"
10977
11102
  },
10978
11103
  {
10979
11104
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
10980
11105
  name: "Pualula",
10981
11106
  parentId: null,
10982
- validUntil: null,
10983
11107
  externalId: "Aq91DweLmT8k"
10984
11108
  },
10985
11109
  {
10986
11110
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
10987
11111
  name: "Chuminga",
10988
11112
  parentId: null,
10989
- validUntil: null,
10990
11113
  externalId: "Rw0fYNh2Xk9a"
10991
11114
  },
10992
11115
  {
10993
11116
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10994
11117
  name: "Ibombo",
10995
11118
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10996
- validUntil: null,
10997
11119
  externalId: "k7DsP4vbN1Qe"
10998
11120
  },
10999
11121
  {
11000
11122
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
11001
11123
  name: "Isango",
11002
11124
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11003
- validUntil: null,
11004
11125
  externalId: "Gm3Z9eQpHw4L"
11005
11126
  },
11006
11127
  {
11007
11128
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
11008
11129
  name: "Isamba",
11009
11130
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11010
- validUntil: null,
11011
11131
  externalId: "sT0xVu1KqJ7r"
11012
11132
  },
11013
11133
  {
11014
11134
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
11015
11135
  name: "Itambo",
11016
11136
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11017
- validUntil: null,
11018
11137
  externalId: "Nq6Bv2HpL9Te"
11019
11138
  },
11020
11139
  {
11021
11140
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
11022
11141
  name: "Ezhi",
11023
11142
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11024
- validUntil: null,
11025
11143
  externalId: "xK8cQ0ZRy5Wd"
11026
11144
  },
11027
11145
  {
11028
11146
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
11029
11147
  name: "Ilanga",
11030
11148
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
11031
- validUntil: null,
11032
11149
  externalId: "Cq4Jm1XvN8Ls"
11033
11150
  },
11034
11151
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -11036,49 +11153,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11036
11153
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
11037
11154
  name: "Klow",
11038
11155
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11039
- validUntil: null,
11040
11156
  externalId: "IkYcYBUcyY2"
11041
11157
  },
11042
11158
  {
11043
11159
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
11044
11160
  name: "Mbondo",
11045
11161
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11046
- validUntil: null,
11047
11162
  externalId: "Qhvv5hvo3mY"
11048
11163
  },
11049
11164
  {
11050
11165
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
11051
11166
  name: "Ndara",
11052
11167
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11053
- validUntil: null,
11054
11168
  externalId: "crXh068O9TR"
11055
11169
  },
11056
11170
  {
11057
11171
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
11058
11172
  name: "Olani",
11059
11173
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11060
- validUntil: null,
11061
11174
  externalId: "r00It8Tvvp7"
11062
11175
  },
11063
11176
  {
11064
11177
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
11065
11178
  name: "Pemba",
11066
11179
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11067
- validUntil: null,
11068
11180
  externalId: "ZnUWsbONIaH"
11069
11181
  },
11070
11182
  {
11071
11183
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
11072
11184
  name: "Quanza",
11073
11185
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11074
- validUntil: null,
11075
11186
  externalId: "fDZycvQTa7l"
11076
11187
  },
11077
11188
  {
11078
11189
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
11079
11190
  name: "Rivka",
11080
11191
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11081
- validUntil: null,
11082
11192
  externalId: "KqswxCGTELa"
11083
11193
  },
11084
11194
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -11086,35 +11196,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11086
11196
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
11087
11197
  name: "Mbula",
11088
11198
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11089
- validUntil: null,
11090
11199
  externalId: "osEbKjRc9Kg"
11091
11200
  },
11092
11201
  {
11093
11202
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
11094
11203
  name: "Ndoki",
11095
11204
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11096
- validUntil: null,
11097
11205
  externalId: "aq4daBUAGr3"
11098
11206
  },
11099
11207
  {
11100
11208
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
11101
11209
  name: "Tsanga",
11102
11210
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11103
- validUntil: null,
11104
11211
  externalId: "cqis6Y8trbJ"
11105
11212
  },
11106
11213
  {
11107
11214
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
11108
11215
  name: "Waziri",
11109
11216
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11110
- validUntil: null,
11111
11217
  externalId: "LMijHPyyx6d"
11112
11218
  },
11113
11219
  {
11114
11220
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
11115
11221
  name: "Zimbi",
11116
11222
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11117
- validUntil: null,
11118
11223
  externalId: "pcQYbPuKGZ7"
11119
11224
  },
11120
11225
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -11122,67 +11227,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11122
11227
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
11123
11228
  name: "Felani",
11124
11229
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11125
- validUntil: null,
11126
11230
  externalId: "gSqpoCGdMXp"
11127
11231
  },
11128
11232
  {
11129
11233
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
11130
11234
  name: "Goroma",
11131
11235
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11132
- validUntil: null,
11133
11236
  externalId: "KvAAIaNqVrp"
11134
11237
  },
11135
11238
  {
11136
11239
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
11137
11240
  name: "Halifu",
11138
11241
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11139
- validUntil: null,
11140
11242
  externalId: "qe4UnEVt1hv"
11141
11243
  },
11142
11244
  {
11143
11245
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
11144
11246
  name: "Jabari",
11145
11247
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11146
- validUntil: null,
11147
11248
  externalId: "yHH9Nz4rLOt"
11148
11249
  },
11149
11250
  {
11150
11251
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
11151
11252
  name: "Kifani",
11152
11253
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11153
- validUntil: null,
11154
11254
  externalId: "eSWmXIGeu1I"
11155
11255
  },
11156
11256
  {
11157
11257
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
11158
11258
  name: "Lumela",
11159
11259
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11160
- validUntil: null,
11161
11260
  externalId: "bh0b3aI1uP3"
11162
11261
  }
11163
11262
  ];
11164
- var V2_DEFAULT_MOCK_LOCATIONS = [
11263
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
11264
+ var MOCK_LOCATIONS_BASE = [
11165
11265
  {
11166
11266
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
11167
11267
  name: "Central Provincial Office",
11168
11268
  locationType: "CRVS_OFFICE",
11169
11269
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11170
- validUntil: null,
11171
11270
  externalId: "Xr3Df8WpK6Ys"
11172
11271
  },
11173
11272
  {
11174
11273
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
11175
11274
  name: "Central Health Post",
11176
11275
  locationType: "HEALTH_FACILITY",
11177
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11178
- validUntil: null
11276
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
11179
11277
  },
11180
11278
  {
11181
11279
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
11182
11280
  name: "Ibombo District Office",
11183
11281
  locationType: "CRVS_OFFICE",
11184
11282
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11185
- validUntil: null,
11186
11283
  externalId: "Sm4Nw7GrD2Vy"
11187
11284
  },
11188
11285
  {
@@ -11190,7 +11287,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11190
11287
  name: "Isamba District Office",
11191
11288
  locationType: "CRVS_OFFICE",
11192
11289
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11193
- validUntil: null,
11194
11290
  externalId: "Vg1Bq5XeH9Lt"
11195
11291
  },
11196
11292
  {
@@ -11198,7 +11294,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11198
11294
  name: "Isango District Office",
11199
11295
  locationType: "CRVS_OFFICE",
11200
11296
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
11201
- validUntil: null,
11202
11297
  externalId: "Je7Lm2XqN9Vz"
11203
11298
  },
11204
11299
  {
@@ -11206,7 +11301,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11206
11301
  name: "Sulaka Provincial Office",
11207
11302
  locationType: "CRVS_OFFICE",
11208
11303
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
11209
- validUntil: null,
11210
11304
  externalId: "Ht2Wp9KcX5Qv"
11211
11305
  },
11212
11306
  {
@@ -11214,7 +11308,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11214
11308
  name: "Ilanga District Office",
11215
11309
  locationType: "CRVS_OFFICE",
11216
11310
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
11217
- validUntil: null,
11218
11311
  externalId: "Yp6Ds1WqN3Xz"
11219
11312
  },
11220
11313
  {
@@ -11222,7 +11315,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11222
11315
  name: "Chamakubi Health Post",
11223
11316
  locationType: "HEALTH_FACILITY",
11224
11317
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11225
- validUntil: null,
11226
11318
  externalId: "M1nFr8LbC2Qy"
11227
11319
  },
11228
11320
  {
@@ -11230,7 +11322,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11230
11322
  name: "Ibombo Rural Health Centre",
11231
11323
  locationType: "HEALTH_FACILITY",
11232
11324
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11233
- validUntil: null,
11234
11325
  externalId: "bT7pV6YrW0Xc"
11235
11326
  },
11236
11327
  {
@@ -11238,7 +11329,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11238
11329
  name: "Chikobo Rural Health Centre",
11239
11330
  locationType: "HEALTH_FACILITY",
11240
11331
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11241
- validUntil: null,
11242
11332
  externalId: "zE4qPn2SgJ5d"
11243
11333
  },
11244
11334
  {
@@ -11246,7 +11336,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11246
11336
  name: "Chilochabalenje Health Post",
11247
11337
  locationType: "HEALTH_FACILITY",
11248
11338
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11249
- validUntil: null,
11250
11339
  externalId: "H8vDs1MqR4Uf"
11251
11340
  },
11252
11341
  {
@@ -11254,7 +11343,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11254
11343
  name: "Chipeso Rural Health Centre",
11255
11344
  locationType: "HEALTH_FACILITY",
11256
11345
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11257
- validUntil: null,
11258
11346
  externalId: "Qw3uZ9KfX6Lm"
11259
11347
  },
11260
11348
  {
@@ -11262,7 +11350,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11262
11350
  name: "Chisamba Rural Health Centre",
11263
11351
  locationType: "HEALTH_FACILITY",
11264
11352
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11265
- validUntil: null,
11266
11353
  externalId: "Yr0pCg8LdM2s"
11267
11354
  },
11268
11355
  {
@@ -11270,7 +11357,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11270
11357
  name: "Chitanda Rural Health Centre",
11271
11358
  locationType: "HEALTH_FACILITY",
11272
11359
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11273
- validUntil: null,
11274
11360
  externalId: "tS9gJ4PwB1Qx"
11275
11361
  },
11276
11362
  {
@@ -11278,7 +11364,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11278
11364
  name: "Golden Valley Rural Health Centre",
11279
11365
  locationType: "HEALTH_FACILITY",
11280
11366
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11281
- validUntil: null,
11282
11367
  externalId: "Ld7Qm3XsA8Vr"
11283
11368
  },
11284
11369
  {
@@ -11286,7 +11371,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11286
11371
  name: "Ipongo Rural Health Centre",
11287
11372
  locationType: "HEALTH_FACILITY",
11288
11373
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11289
- validUntil: null,
11290
11374
  externalId: "kF2sW9DmH0Bt"
11291
11375
  },
11292
11376
  {
@@ -11294,7 +11378,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11294
11378
  name: "Itumbwe Health Post",
11295
11379
  locationType: "HEALTH_FACILITY",
11296
11380
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11297
- validUntil: null,
11298
11381
  externalId: "Ue5Xb3VaC7Pq"
11299
11382
  },
11300
11383
  {
@@ -11302,7 +11385,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11302
11385
  name: "Kabangalala Rural Health Centre",
11303
11386
  locationType: "HEALTH_FACILITY",
11304
11387
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11305
- validUntil: null,
11306
11388
  externalId: "Pz8Kc1TqH6Jn"
11307
11389
  },
11308
11390
  // Village offices
@@ -11311,13 +11393,61 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11311
11393
  name: "Klow Village Office",
11312
11394
  locationType: "CRVS_OFFICE",
11313
11395
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
11314
- validUntil: null,
11315
11396
  externalId: "PmAyxAJkxiJ"
11316
11397
  }
11317
11398
  ];
11399
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
11318
11400
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
11319
11401
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
11320
11402
  );
11321
11403
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
11322
11404
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
11323
11405
  );
11406
+
11407
+ // ../commons/src/events/locationPayloads.ts
11408
+ var z44 = __toESM(require("zod/v4"));
11409
+ var CreateLocationPayload = z44.object({
11410
+ id: UUID.optional(),
11411
+ versionId: UUID.optional(),
11412
+ name: z44.string(),
11413
+ externalId: z44.string().nullish(),
11414
+ administrativeAreaId: UUID.nullable(),
11415
+ locationType: z44.string().nullable(),
11416
+ effectiveFrom: z44.iso.date().optional(),
11417
+ status: LocationStatus.default("active")
11418
+ });
11419
+ var UpdateLocationPayload = z44.strictObject({
11420
+ id: UUID,
11421
+ versionId: UUID.optional(),
11422
+ name: z44.string(),
11423
+ externalId: z44.string().nullish(),
11424
+ status: LocationStatus,
11425
+ effectiveFrom: z44.iso.date().optional(),
11426
+ lastVersionId: UUID
11427
+ });
11428
+ var WithdrawLocationVersionPayload = z44.object({
11429
+ id: UUID,
11430
+ versionId: UUID
11431
+ });
11432
+ var CreateAdministrativeAreaPayload = z44.object({
11433
+ id: UUID.optional(),
11434
+ versionId: UUID.optional(),
11435
+ name: z44.string(),
11436
+ externalId: z44.string().nullish(),
11437
+ parentId: UUID.nullable(),
11438
+ effectiveFrom: z44.iso.date().optional(),
11439
+ status: LocationStatus.default("active")
11440
+ });
11441
+ var UpdateAdministrativeAreaPayload = z44.strictObject({
11442
+ id: UUID,
11443
+ versionId: UUID.optional(),
11444
+ name: z44.string(),
11445
+ externalId: z44.string().nullish(),
11446
+ status: LocationStatus,
11447
+ effectiveFrom: z44.iso.date().optional(),
11448
+ lastVersionId: UUID
11449
+ });
11450
+ var WithdrawAdministrativeAreaVersionPayload = z44.object({
11451
+ id: UUID,
11452
+ versionId: UUID
11453
+ });