@opencrvs/toolkit 2.1.0-rc.47017f6 → 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.
Files changed (70) hide show
  1. package/dist/application-config/index.js +3 -1
  2. package/dist/cli.js +0 -48
  3. package/dist/commons/api/router.d.ts +3546 -3359
  4. package/dist/commons/application-config/index.d.ts +6 -6
  5. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  6. package/dist/commons/events/ActionConfig.d.ts +105 -105
  7. package/dist/commons/events/ActionDocument.d.ts +119 -119
  8. package/dist/commons/events/ActionInput.d.ts +0 -6
  9. package/dist/commons/events/ActionType.d.ts +62 -62
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -507
  11. package/dist/commons/events/AuditLog.d.ts +151 -42
  12. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  13. package/dist/commons/events/Conditional.d.ts +3 -3
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  15. package/dist/commons/events/Draft.d.ts +37 -37
  16. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  17. package/dist/commons/events/EventConfig.d.ts +5 -5
  18. package/dist/commons/events/EventDocument.d.ts +48 -48
  19. package/dist/commons/events/EventIndex.d.ts +62 -62
  20. package/dist/commons/events/EventMetadata.d.ts +40 -40
  21. package/dist/commons/events/FieldConfig.d.ts +341 -336
  22. package/dist/commons/events/FieldType.d.ts +51 -51
  23. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  24. package/dist/commons/events/FieldValue.d.ts +12 -12
  25. package/dist/commons/events/Flag.d.ts +15 -15
  26. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  28. package/dist/commons/events/WorkqueueConfig.d.ts +826 -826
  29. package/dist/commons/events/deduplication.d.ts +1 -1
  30. package/dist/commons/events/event.d.ts +2 -2
  31. package/dist/commons/events/field.d.ts +69 -198
  32. package/dist/commons/events/index.d.ts +1 -0
  33. package/dist/commons/events/locationPayloads.d.ts +95 -0
  34. package/dist/commons/events/locations.d.ts +103 -6
  35. package/dist/commons/events/mocks.test.utils.d.ts +18 -4
  36. package/dist/commons/events/scopes.d.ts +4 -4
  37. package/dist/commons/events/state/index.d.ts +17 -17
  38. package/dist/commons/events/state/utils.d.ts +7 -7
  39. package/dist/commons/events/test.utils.d.ts +40 -43
  40. package/dist/commons/events/utils.d.ts +114 -114
  41. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  42. package/dist/conditionals/index.js +1 -0
  43. package/dist/environment/derived-variables.d.ts +119 -131
  44. package/dist/environment/derived-variables.d.ts.map +1 -1
  45. package/dist/environment/derived-variables.js +0 -14
  46. package/dist/environment/logger.d.ts +3 -12
  47. package/dist/environment/logger.d.ts.map +1 -1
  48. package/dist/environment/manage-users.js +17 -7
  49. package/dist/environment/questions.d.ts +75 -74
  50. package/dist/environment/questions.d.ts.map +1 -1
  51. package/dist/environment/setup-environment.js +8 -28
  52. package/dist/environment/swarm-to-k8s.js +17 -7
  53. package/dist/environment/update-workflows.js +17 -7
  54. package/dist/environment/users.js +17 -7
  55. package/dist/environment/utils.d.ts +1 -1
  56. package/dist/environment/utils.js +17 -7
  57. package/dist/events/deduplication.d.ts +1 -1
  58. package/dist/events/index.js +185 -58
  59. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  60. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  61. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  62. package/dist/notification/index.js +182 -82
  63. package/dist/scopes/index.d.ts +148 -146
  64. package/dist/scopes/index.js +1 -0
  65. package/dist/templates/charts-values/dependencies/values.yaml +0 -3
  66. package/dist/templates/charts-values/opencrvs-services/values.yaml +0 -4
  67. package/opencrvs-toolkit-2.1.0-rc.47be1be.tgz +0 -0
  68. package/package.json +5 -5
  69. package/tsconfig.tsbuildinfo +1 -1
  70. package/opencrvs-toolkit-2.1.0-rc.47017f6.tgz +0 -0
@@ -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,
@@ -1676,9 +1749,10 @@ var NotifiedAction = ActionBase.extend(
1676
1749
  var EditAction = ActionBase.extend(
1677
1750
  z14.object({
1678
1751
  type: z14.literal(ActionType.EDIT),
1752
+ /** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
1679
1753
  content: z14.object({
1680
1754
  comment: z14.string().describe("Comment for the edit action.").optional()
1681
- })
1755
+ }).optional()
1682
1756
  }).shape
1683
1757
  );
1684
1758
  var PrintContent = z14.object({
@@ -6415,10 +6489,7 @@ var DeclareActionInput = BaseActionInput.extend(
6415
6489
  );
6416
6490
  var EditActionInput = BaseActionInput.extend(
6417
6491
  z38.object({
6418
- type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
6419
- content: z38.object({
6420
- comment: z38.string().describe("Comment for the edit action.").optional()
6421
- })
6492
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
6422
6493
  }).shape
6423
6494
  );
6424
6495
  var PrintCertificateActionInput = BaseActionInput.extend(
@@ -9963,7 +10034,6 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
9963
10034
  },
9964
10035
  edit: (eventId, input = {}) => ({
9965
10036
  type: ActionType.EDIT,
9966
- content: { comment: "Test comment" },
9967
10037
  transactionId: input.transactionId ?? getUUID(),
9968
10038
  declaration: input.declaration ?? generateActionDeclarationInput(configuration, ActionType.EDIT, rng),
9969
10039
  annotation: input.annotation ?? generateActionAnnotationInput(configuration, ActionType.EDIT, rng),
@@ -10469,21 +10539,60 @@ var LocationTypeV1 = z43.enum([
10469
10539
  "CRVS_OFFICE",
10470
10540
  "HEALTH_FACILITY"
10471
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
+ });
10472
10550
  var AdministrativeArea = z43.object({
10473
10551
  id: UUID,
10474
10552
  name: z43.string(),
10475
10553
  externalId: z43.string().nullish(),
10476
10554
  parentId: UUID.nullable(),
10477
- validUntil: z43.iso.datetime().nullable()
10555
+ status: LocationStatus,
10556
+ versions: z43.array(LocationVersion)
10478
10557
  });
10479
10558
  var Location = z43.object({
10480
10559
  id: UUID,
10481
10560
  name: z43.string(),
10482
10561
  externalId: z43.string().nullish(),
10483
10562
  administrativeAreaId: UUID.nullable(),
10484
- 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(),
10485
10572
  locationType: z43.string().nullable()
10486
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
+ }
10487
10596
  function matchesJurisdictionFilter(locationIds, filter, user2) {
10488
10597
  if (!locationIds) {
10489
10598
  return false;
@@ -10963,75 +11072,80 @@ function getFilePathsFromEvent(event2) {
10963
11072
  }
10964
11073
 
10965
11074
  // ../commons/src/events/mocks.test.utils.ts
10966
- 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 = [
10967
11091
  {
10968
11092
  id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10969
11093
  name: "Central",
10970
11094
  parentId: null,
10971
- validUntil: null,
10972
11095
  externalId: "ydyJb1RAy4U1"
10973
11096
  },
10974
11097
  {
10975
11098
  id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10976
11099
  name: "Sulaka",
10977
11100
  parentId: null,
10978
- validUntil: null,
10979
11101
  externalId: "pQ8nGxWmZ2Q3"
10980
11102
  },
10981
11103
  {
10982
11104
  id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
10983
11105
  name: "Pualula",
10984
11106
  parentId: null,
10985
- validUntil: null,
10986
11107
  externalId: "Aq91DweLmT8k"
10987
11108
  },
10988
11109
  {
10989
11110
  id: "6d1a59df-988c-4021-a846-ccbc021931a7",
10990
11111
  name: "Chuminga",
10991
11112
  parentId: null,
10992
- validUntil: null,
10993
11113
  externalId: "Rw0fYNh2Xk9a"
10994
11114
  },
10995
11115
  {
10996
11116
  id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10997
11117
  name: "Ibombo",
10998
11118
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10999
- validUntil: null,
11000
11119
  externalId: "k7DsP4vbN1Qe"
11001
11120
  },
11002
11121
  {
11003
11122
  id: "27160bbd-32d1-4625-812f-860226bfb92a",
11004
11123
  name: "Isango",
11005
11124
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11006
- validUntil: null,
11007
11125
  externalId: "Gm3Z9eQpHw4L"
11008
11126
  },
11009
11127
  {
11010
11128
  id: "967032fd-3f81-478a-826c-30cb8fe121bd",
11011
11129
  name: "Isamba",
11012
11130
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11013
- validUntil: null,
11014
11131
  externalId: "sT0xVu1KqJ7r"
11015
11132
  },
11016
11133
  {
11017
11134
  id: "89a33893-b17d-481d-a26d-6461e7ac1651",
11018
11135
  name: "Itambo",
11019
11136
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11020
- validUntil: null,
11021
11137
  externalId: "Nq6Bv2HpL9Te"
11022
11138
  },
11023
11139
  {
11024
11140
  id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
11025
11141
  name: "Ezhi",
11026
11142
  parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11027
- validUntil: null,
11028
11143
  externalId: "xK8cQ0ZRy5Wd"
11029
11144
  },
11030
11145
  {
11031
11146
  id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
11032
11147
  name: "Ilanga",
11033
11148
  parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
11034
- validUntil: null,
11035
11149
  externalId: "Cq4Jm1XvN8Ls"
11036
11150
  },
11037
11151
  // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
@@ -11039,49 +11153,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11039
11153
  id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
11040
11154
  name: "Klow",
11041
11155
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11042
- validUntil: null,
11043
11156
  externalId: "IkYcYBUcyY2"
11044
11157
  },
11045
11158
  {
11046
11159
  id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
11047
11160
  name: "Mbondo",
11048
11161
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11049
- validUntil: null,
11050
11162
  externalId: "Qhvv5hvo3mY"
11051
11163
  },
11052
11164
  {
11053
11165
  id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
11054
11166
  name: "Ndara",
11055
11167
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11056
- validUntil: null,
11057
11168
  externalId: "crXh068O9TR"
11058
11169
  },
11059
11170
  {
11060
11171
  id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
11061
11172
  name: "Olani",
11062
11173
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11063
- validUntil: null,
11064
11174
  externalId: "r00It8Tvvp7"
11065
11175
  },
11066
11176
  {
11067
11177
  id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
11068
11178
  name: "Pemba",
11069
11179
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11070
- validUntil: null,
11071
11180
  externalId: "ZnUWsbONIaH"
11072
11181
  },
11073
11182
  {
11074
11183
  id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
11075
11184
  name: "Quanza",
11076
11185
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11077
- validUntil: null,
11078
11186
  externalId: "fDZycvQTa7l"
11079
11187
  },
11080
11188
  {
11081
11189
  id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
11082
11190
  name: "Rivka",
11083
11191
  parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11084
- validUntil: null,
11085
11192
  externalId: "KqswxCGTELa"
11086
11193
  },
11087
11194
  // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
@@ -11089,35 +11196,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11089
11196
  id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
11090
11197
  name: "Mbula",
11091
11198
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11092
- validUntil: null,
11093
11199
  externalId: "osEbKjRc9Kg"
11094
11200
  },
11095
11201
  {
11096
11202
  id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
11097
11203
  name: "Ndoki",
11098
11204
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11099
- validUntil: null,
11100
11205
  externalId: "aq4daBUAGr3"
11101
11206
  },
11102
11207
  {
11103
11208
  id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
11104
11209
  name: "Tsanga",
11105
11210
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11106
- validUntil: null,
11107
11211
  externalId: "cqis6Y8trbJ"
11108
11212
  },
11109
11213
  {
11110
11214
  id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
11111
11215
  name: "Waziri",
11112
11216
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11113
- validUntil: null,
11114
11217
  externalId: "LMijHPyyx6d"
11115
11218
  },
11116
11219
  {
11117
11220
  id: "2c5d6e7f-8a9b-4423-8def-456789012345",
11118
11221
  name: "Zimbi",
11119
11222
  parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11120
- validUntil: null,
11121
11223
  externalId: "pcQYbPuKGZ7"
11122
11224
  },
11123
11225
  // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
@@ -11125,67 +11227,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
11125
11227
  id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
11126
11228
  name: "Felani",
11127
11229
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11128
- validUntil: null,
11129
11230
  externalId: "gSqpoCGdMXp"
11130
11231
  },
11131
11232
  {
11132
11233
  id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
11133
11234
  name: "Goroma",
11134
11235
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11135
- validUntil: null,
11136
11236
  externalId: "KvAAIaNqVrp"
11137
11237
  },
11138
11238
  {
11139
11239
  id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
11140
11240
  name: "Halifu",
11141
11241
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11142
- validUntil: null,
11143
11242
  externalId: "qe4UnEVt1hv"
11144
11243
  },
11145
11244
  {
11146
11245
  id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
11147
11246
  name: "Jabari",
11148
11247
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11149
- validUntil: null,
11150
11248
  externalId: "yHH9Nz4rLOt"
11151
11249
  },
11152
11250
  {
11153
11251
  id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
11154
11252
  name: "Kifani",
11155
11253
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11156
- validUntil: null,
11157
11254
  externalId: "eSWmXIGeu1I"
11158
11255
  },
11159
11256
  {
11160
11257
  id: "8c1d2e3f-4a5b-4089-8def-012345678901",
11161
11258
  name: "Lumela",
11162
11259
  parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
11163
- validUntil: null,
11164
11260
  externalId: "bh0b3aI1uP3"
11165
11261
  }
11166
11262
  ];
11167
- var V2_DEFAULT_MOCK_LOCATIONS = [
11263
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
11264
+ var MOCK_LOCATIONS_BASE = [
11168
11265
  {
11169
11266
  id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
11170
11267
  name: "Central Provincial Office",
11171
11268
  locationType: "CRVS_OFFICE",
11172
11269
  administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11173
- validUntil: null,
11174
11270
  externalId: "Xr3Df8WpK6Ys"
11175
11271
  },
11176
11272
  {
11177
11273
  id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
11178
11274
  name: "Central Health Post",
11179
11275
  locationType: "HEALTH_FACILITY",
11180
- administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
11181
- validUntil: null
11276
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
11182
11277
  },
11183
11278
  {
11184
11279
  id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
11185
11280
  name: "Ibombo District Office",
11186
11281
  locationType: "CRVS_OFFICE",
11187
11282
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11188
- validUntil: null,
11189
11283
  externalId: "Sm4Nw7GrD2Vy"
11190
11284
  },
11191
11285
  {
@@ -11193,7 +11287,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11193
11287
  name: "Isamba District Office",
11194
11288
  locationType: "CRVS_OFFICE",
11195
11289
  administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
11196
- validUntil: null,
11197
11290
  externalId: "Vg1Bq5XeH9Lt"
11198
11291
  },
11199
11292
  {
@@ -11201,7 +11294,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11201
11294
  name: "Isango District Office",
11202
11295
  locationType: "CRVS_OFFICE",
11203
11296
  administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
11204
- validUntil: null,
11205
11297
  externalId: "Je7Lm2XqN9Vz"
11206
11298
  },
11207
11299
  {
@@ -11209,7 +11301,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11209
11301
  name: "Sulaka Provincial Office",
11210
11302
  locationType: "CRVS_OFFICE",
11211
11303
  administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
11212
- validUntil: null,
11213
11304
  externalId: "Ht2Wp9KcX5Qv"
11214
11305
  },
11215
11306
  {
@@ -11217,7 +11308,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11217
11308
  name: "Ilanga District Office",
11218
11309
  locationType: "CRVS_OFFICE",
11219
11310
  administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
11220
- validUntil: null,
11221
11311
  externalId: "Yp6Ds1WqN3Xz"
11222
11312
  },
11223
11313
  {
@@ -11225,7 +11315,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11225
11315
  name: "Chamakubi Health Post",
11226
11316
  locationType: "HEALTH_FACILITY",
11227
11317
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11228
- validUntil: null,
11229
11318
  externalId: "M1nFr8LbC2Qy"
11230
11319
  },
11231
11320
  {
@@ -11233,7 +11322,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11233
11322
  name: "Ibombo Rural Health Centre",
11234
11323
  locationType: "HEALTH_FACILITY",
11235
11324
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11236
- validUntil: null,
11237
11325
  externalId: "bT7pV6YrW0Xc"
11238
11326
  },
11239
11327
  {
@@ -11241,7 +11329,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11241
11329
  name: "Chikobo Rural Health Centre",
11242
11330
  locationType: "HEALTH_FACILITY",
11243
11331
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11244
- validUntil: null,
11245
11332
  externalId: "zE4qPn2SgJ5d"
11246
11333
  },
11247
11334
  {
@@ -11249,7 +11336,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11249
11336
  name: "Chilochabalenje Health Post",
11250
11337
  locationType: "HEALTH_FACILITY",
11251
11338
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11252
- validUntil: null,
11253
11339
  externalId: "H8vDs1MqR4Uf"
11254
11340
  },
11255
11341
  {
@@ -11257,7 +11343,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11257
11343
  name: "Chipeso Rural Health Centre",
11258
11344
  locationType: "HEALTH_FACILITY",
11259
11345
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11260
- validUntil: null,
11261
11346
  externalId: "Qw3uZ9KfX6Lm"
11262
11347
  },
11263
11348
  {
@@ -11265,7 +11350,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11265
11350
  name: "Chisamba Rural Health Centre",
11266
11351
  locationType: "HEALTH_FACILITY",
11267
11352
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11268
- validUntil: null,
11269
11353
  externalId: "Yr0pCg8LdM2s"
11270
11354
  },
11271
11355
  {
@@ -11273,7 +11357,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11273
11357
  name: "Chitanda Rural Health Centre",
11274
11358
  locationType: "HEALTH_FACILITY",
11275
11359
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11276
- validUntil: null,
11277
11360
  externalId: "tS9gJ4PwB1Qx"
11278
11361
  },
11279
11362
  {
@@ -11281,7 +11364,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11281
11364
  name: "Golden Valley Rural Health Centre",
11282
11365
  locationType: "HEALTH_FACILITY",
11283
11366
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11284
- validUntil: null,
11285
11367
  externalId: "Ld7Qm3XsA8Vr"
11286
11368
  },
11287
11369
  {
@@ -11289,7 +11371,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11289
11371
  name: "Ipongo Rural Health Centre",
11290
11372
  locationType: "HEALTH_FACILITY",
11291
11373
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11292
- validUntil: null,
11293
11374
  externalId: "kF2sW9DmH0Bt"
11294
11375
  },
11295
11376
  {
@@ -11297,7 +11378,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11297
11378
  name: "Itumbwe Health Post",
11298
11379
  locationType: "HEALTH_FACILITY",
11299
11380
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11300
- validUntil: null,
11301
11381
  externalId: "Ue5Xb3VaC7Pq"
11302
11382
  },
11303
11383
  {
@@ -11305,7 +11385,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11305
11385
  name: "Kabangalala Rural Health Centre",
11306
11386
  locationType: "HEALTH_FACILITY",
11307
11387
  administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
11308
- validUntil: null,
11309
11388
  externalId: "Pz8Kc1TqH6Jn"
11310
11389
  },
11311
11390
  // Village offices
@@ -11314,13 +11393,61 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
11314
11393
  name: "Klow Village Office",
11315
11394
  locationType: "CRVS_OFFICE",
11316
11395
  administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
11317
- validUntil: null,
11318
11396
  externalId: "PmAyxAJkxiJ"
11319
11397
  }
11320
11398
  ];
11399
+ var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
11321
11400
  var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
11322
11401
  V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
11323
11402
  );
11324
11403
  var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
11325
11404
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
11326
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
+ });
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
25
25
  }) : function(o, v) {
26
26
  o["default"] = v;
27
27
  });
28
- var __importStar = (this && this.__importStar) || function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
35
45
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
46
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
47
  return new (P || (P = Promise))(function (resolve, reject) {